Header Ad

HackerEarth Game of Coins problem solution

In this HackerEarth Game of Coins problem solution, Alice and Bob are playing a game of coins. N coins are placed on the table in a row. The game begins with Alice and afterward they alternate the moves. A valid move is defined as follows:

You pick one coin or two adjacent coins and remove them. The game is over if anyone is not able to make any valid move, and the other person wins. we have given N, print "Alice" or "Bob" corresponding to who wins the game.


HackerEarth Game of Coins problem solution


HackerEarth Game of Coins problem solution.

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<cassert>
#include<sstream>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,b) for(i=0;i<b;i++)
#define rep1(i,b) for(i=1;i<=b;i++)
#define pdn(n) printf("%d\n",n)
#define sl(n) scanf("%lld",&n)
#define sd(n) scanf("%d",&n)
#define pn printf("\n")
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long LL;
#define MOD 1000000007
LL mpow(LL a, LL n)
{LL ret=1;LL b=a;while(n) {if(n&1)
ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;}
return (LL)ret;}
LL arr[1009];
int main()
{
int t;
sd(t);
while(t--)
{
LL n,s=0,i;
sl(n);
printf("Alice\n");
}
return 0;
}

Post a Comment

0 Comments