Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 7684 Accepted Submission(s):
3870
1 #include "bits/stdc++.h" 2 using namespace std; 3 typedef long long LL; 4 int cas; 5 int n,m; 6 int gcd(int a,int b){ 7 if (b==0) return a; 8 else return gcd(b,a%b); 9 } 10 int main(){ 11 freopen ("wolf.in","r",stdin); 12 freopen ("wolf.out","w",stdout); 13 int i,j; 14 scanf("%d",&cas); 15 while (cas--){ 16 scanf("%d%d",&n,&m); 17 if (gcd(n,m)==1) 18 puts("NO"); 19 else 20 puts("YES"); 21 } 22 return 0; 23 }
HDU-1222 Wolf and Rabbit (欧几里得定理)
原文:http://www.cnblogs.com/keximeiruguo/p/6057896.html