title: Coin Game Winner Every Player Three Choices
signature: class Solution {
  
      public bool CoinGameWinnerEveryPlayerThreeChoices(int x, int y, int n) {
test_code: using System;
  using System.Numerics;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Security.Cryptography;
  using System.Web.UI;
  using System.Web.Script.Serialization;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  namespace EvaluatePrediction {
      class TestRunner {
          public bool ValidateSolution(bool actual, bool expected){
              return new JavaScriptSerializer().Serialize(actual) == new JavaScriptSerializer().Serialize(expected);
          }
  
          public string driver(int x, int y, int n, bool expected){
              try{
                PLACEHOLDER_CLS_NAME solution_cls = new PLACEHOLDER_CLS_NAME();
                bool pred_result = solution_cls.PLACEHOLDER_FN_NAME(x, y, n); 
                if (ValidateSolution(
                      pred_result,
                      expected)){
                  return "PASSED";
                }
                return "FAILED";
              } 
              catch (Exception exception_obj)
              {
                return exception_obj.GetType().FullName;
              }
          }
          static void Main(string[] args) {
              TestRunner runner = new TestRunner();
              String result;
              result = runner.driver(
                  6, 27, 51, 
                  false
              );
              Console.WriteLine(string.Format(
                  "TEST-0...{0}",
                  result)
              );result = runner.driver(
                  32, 88, 69, 
                  true
              );
              Console.WriteLine(string.Format(
                  "TEST-1...{0}",
                  result)
              );result = runner.driver(
                  99, 18, 48, 
                  false
              );
              Console.WriteLine(string.Format(
                  "TEST-2...{0}",
                  result)
              );result = runner.driver(
                  22, 1, 74, 
                  true
              );
              Console.WriteLine(string.Format(
                  "TEST-3...{0}",
                  result)
              );result = runner.driver(
                  26, 78, 95, 
                  false
              );
              Console.WriteLine(string.Format(
                  "TEST-4...{0}",
                  result)
              );result = runner.driver(
                  67, 51, 27, 
                  true
              );
              Console.WriteLine(string.Format(
                  "TEST-5...{0}",
                  result)
              );result = runner.driver(
                  69, 57, 91, 
                  true
              );
              Console.WriteLine(string.Format(
                  "TEST-6...{0}",
                  result)
              );result = runner.driver(
                  39, 8, 9, 
                  false
              );
              Console.WriteLine(string.Format(
                  "TEST-7...{0}",
                  result)
              );result = runner.driver(
                  7, 82, 41, 
                  true
              );
              Console.WriteLine(string.Format(
                  "TEST-8...{0}",
                  result)
              );result = runner.driver(
                  91, 56, 7, 
                  true
              );
              Console.WriteLine(string.Format(
                  "TEST-9...{0}",
                  result)
              );
          }
      }
  }
  
source_py: def coin_game_winner_every_player_three_choices(x, y, n):
      dp = [0 for i in range((n + 1))]
      dp[0] = False
      dp[1] = True
      for i in range(2, (n + 1)):
          if (((i - 1) >= 0) and (not dp[(i - 1)])):
              dp[i] = True
          elif (((i - x) >= 0) and (not dp[(i - x)])):
              dp[i] = True
          elif (((i - y) >= 0) and (not dp[(i - y)])):
              dp[i] = True
          else:
              dp[i] = False
      return dp[n]
source_cpp: bool coin_game_winner_every_player_three_choices(int x, int y, int n) {
    int dp [ n + 1 ];
    dp [ 0 ] = false;
    dp [ 1 ] = true;
    for ( int i = 2;
    i <= n;
    i ++ ) {
      if ( i - 1 >= 0 and ! dp [ i - 1 ] ) dp [ i ] = true;
      else if ( i - x >= 0 and ! dp [ i - x ] ) dp [ i ] = true;
      else if ( i - y >= 0 and ! dp [ i - y ] ) dp [ i ] = true;
      else dp [ i ] = false;
    }
    return dp [ n ];
  }