Adrien and Austin

题目:
Adrien and Austin are playing a game with rocks.
Initially, there are N rocks, indexed from 1 to N. In one move, the player chooses at least 1 and at most
K consecutively indexed rocks (all of them should not have been removed) and removes them from the
game.
Adrien always starts the game, and then Adrien and Austin take turns making moves. The player who is
unable to make a move (because all rocks are removed) loses.
Given N, K, find who is going to win the game (assuming they are smart and are playing optimally).
Input
The first line contains two integers N, K (0 ≤ N ≤ 106
, 1 ≤ K ≤ 106).
Output
Print a name (“Adrien” or “Austin”, without the quotes) — the person who is going to win the game.
Examples
1 1 Adrien
9 3 Adrien

#include<bits/stdc++.h>
using namespace std;
int main(){int n,k;cin>>n>>k;int flag;if(k>=n&&n!=0) flag=1;else{if(n==0) flag=2;if(n%2==1){flag=1;}if(n%2==0&&n!=0){if(k==1){flag=2;}elseflag=1; } }if(flag==1)printf("Adrien\n");else {printf("Austin\n");}	
}

本文链接:https://my.lmcjl.com/post/966.html

展开阅读全文

4 评论

留下您的评论.