现在的位置: 首页 > 综合 > 正文

hdu1222

2018年04月21日 ⁄ 综合 ⁄ 共 266字 ⁄ 字号 评论关闭

GCD的运用

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int Gcd(int x,int y){
    if(y == 0)return x;
    else return Gcd(y,x % y);
}
int main(){
    int n;
    scanf("%d",&n);
    while(n--){
        int x,y;
        scanf("%d%d",&x,&y);
        int s = Gcd(x,y);
        if(s == 1)printf("NO\n");
        else printf("YES\n");
    }
    return 0;
}
【上篇】
【下篇】

抱歉!评论已关闭.