2018南京ICPC-A

本文探讨了Adrien和Austin在一个游戏中如何通过策略选择连续岩石来决定胜负。给定初始岩石数量和每次移除限制,分析最优策略以预测游戏赢家。关键在于理解玩家如何利用规则,特别是当N、K不同时的策略对比。
摘要由CSDN通过智能技术生成

题目: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

在这里插入图片描述

代码

#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
if(a==0)
cout<<"Austin"<<endl;
else if(a<=b)
cout<<"Adrien"<<endl;
else if(b==1){
	if(a%2==0)
	cout<<"Austin"<<endl;
	else
	cout<<"Adrien"<<endl;
}
else{

		cout<<"Adrien"<<endl;
	}	
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值