当前位置: 代码迷 >> 综合 >> HDU:1222wolfnbsp;andnbsp;habbit解题报告
  详细解决方案

HDU:1222wolfnbsp;andnbsp;habbit解题报告

热度:82   发布时间:2024-01-04 11:21:10.0

只要二者互质那么就无处可藏

(其实我也不明白为什么,想不出来数学算法)

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