题解 | 小红与gcd三角形

小红与gcd三角形

https://www.nowcoder.com/practice/bc2d5fd2d2094f5989c94e47d5c93332

#include <iostream>
#include<algorithm>
using namespace std;
int gcd(int n,int m){
    while(m>0){
        int t=m;
        m=n%m;
        n=t;
    }
    return n;
}
int main() {
    int t;
    cin>>t;
    while(t--){
        int x,y;
        cin>>x>>y;
        int g=gcd(x,y);
        int a=min({x,y,g});
        int c=max({x,y,g});
        int b=x+y+g-a-c;
        if(a+b>c)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务