题目链接:http://acm.zzuli.edu.cn/zzuliacm/problem.php?cid=1158&pid=0
Sample Input 2 6 4 2 1 Sample Output No Yes
************************************************
1 #include<iostream> 2 #include<algorithm> 3 #include<cstdio> 4 #include<cstring> 5 #include<queue> 6 #include<stdlib.h> 7 #include<map> 8 #include<cmath> 9 10 using namespace std; 11 12 #define N 5500 13 #define INF 0x3f3f3f3f 14 15 int main() 16 { 17 int T,n,k,ans; 18 19 scanf("%d", &T); 20 21 while(T--) 22 { 23 scanf("%d%d", &n,&k); 24 25 if(k==1) 26 { 27 printf("Yes\n"); 28 continue ; 29 } 30 31 ans=gcd((n-1)*2,k); 32 33 if(ans==1) 34 printf("Yes\n"); 35 else 36 printf("No\n"); 37 } 38 return 0; 39 }
时间: 2024-10-14 06:25:45