题解 | 小红与gcd三角形

小红与gcd三角形

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

#include <iostream>
#include<algorithm>
#include<cmath>
using namespace std;

int gcd(int a, int b) {
    a = abs(a);
    b = abs(b);
    while (b != 0) {
        int temp = b;
        b = a % b;
        a = temp;
    }
    return a;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;
    cin>>t;
    while(t--){
        int a,b;
        cin>>a>>b;
        int c=gcd(a,b);
        if(a+b+c-max(a,max(b,c))>max(a,max(b,c)))cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

递归到脑子变傻:杭州还有上位机用VB的,实在没绷住
点赞 评论 收藏
分享
2025-12-17 17:15
华东师范大学 运营
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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