Description
Input
Output
Sample Input
Sample Output
#include <stdio.h> #define LL long long LL gcd(int a, int b) { return (b == 0) ? a : gcd(b, a%b); } int main() { bool flag; LL t; scanf("%lld", &t); while(t--) { LL m, l; flag = 1; scanf("%lld%lld", &m, &l); if(gcd(m, l) == 1) printf("NO\n"); else printf("YES\n"); } return 0; }
转化为用欧几里得算法判断互质的问题D - Wolf and Rabbit
原文:http://www.cnblogs.com/rain-1/p/4888149.html