zjfc1108,hdu1222 wolf and rabbits

http://acm.hdu.edu.cn/showproblem.php?pid=1222

理解题目:

当两者公约数为1,不存在安全洞。

不为1时,存在安全洞。

#include<stdio.h>
int gcd(int n,int m)
{
 if(m==0) return n;
 return gcd(m,n%m);
}
int main()
{
 int a,b,t;
 scanf("%d",&t);
 while(t--){
  scanf("%d %d",&a,&b);
  if(gcd(a,b)==1)
   printf("NO\n");
  else
   printf("YES\n");
 
 }
}

原文地址:https://www.cnblogs.com/pandy/p/1447323.html