题解 | 小红与gcd三角形

小红与gcd三角形

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

#include <iostream>
using namespace std;

int main() {
    int t;
    cin >>t;
    int x, y, n, max;
    while(t--){
        cin >>x >>y;
        n = x > y ? x :y;
        for(int i = 1; i <=n; i++){
            if(x %i == 0 && y %i == 0){
                max = i;
            }
        }
        if((x+y) > max&& (x+max) >y &&(y +max) > x){
            cout << "Yes"<<endl;
        }else{
            cout << "No" <<endl;
        }
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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