http://acm.hdu.edu.cn/showproblem.php?pid=5512
发现可以建立的寺庙都是a*x+b*y的值域 求一下ab的gcd 则n/gcd则为一共可以修建的寺庙数 判一下奇偶即可
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
int main()
{
int t,cas,n,a,b;
scanf("%d",&t);
for(cas=1;cas<=t;cas++){
scanf("%d%d%d",&n,&a,&b);
printf("Case #%d: ",cas);
if((n/__gcd(a,b))%2==0) printf("Iaka\n");
else printf("Yuwgna\n");
}
return 0;
}