题目链接:Pagodas 题目大意:有n个寺庙,最开始的时候有两个a,b寺庙编号是被标记了的,下一次的标记可以是已经存在的两个不同的被标记了的编号相加或者相减,问到什么时
题目链接:Pagodas
题目大意:有n个寺庙,最开始的时候有两个a,b寺庙编号是被标记了的,下一次的标记可以是已经存在的两个不同的被标记了的编号相加或者相减,问到什么时候就不能标记到未标记的寺庙了,不能标记的那个人算输,问赢的是谁
题目思路:题目给了很多的样例,大概的意思就是叫你去找规律,然后我们可以知道在最开始的时候间距就确定了,就是gcd(a,b),所以,我们需要算一下有多少能被标记,然后判断奇偶就好了
#include <map>#include <set>
#include <cmath>
#include <stack>
#include <queue>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn = 1e6+10;
int T,n,a,b;
int main(){
scanf("%d",&T);
for(int Case = 1; Case <= T;Case++){
scanf("%d%d%d",&n,&a,&b);
int ans = n/__gcd(a,b);
if(ans&1) printf("Case #%d: Yuwgna\n",Case);
else printf("Case #%d: Iaka\n",Case);
}
return 0;
}