美文网首页
1065 A+B and C (64bit)

1065 A+B and C (64bit)

作者: 梅友泥撑 | 来源:发表于2025-04-20 12:40 被阅读0次
#include<iostream>
typedef long long LL;
using namespace std;
int main() {
    int t;
    LL a, b, c;
    bool flag;
    scanf("%d", &t);
    for (int i = 1; i <= t; i++) {
        scanf("%lld%lld%lld", &a, &b, &c);
        LL sum = a + b;//要判断溢出
        if (a > 0 && b > 0 && sum < 0) {
            flag = true;
        }
        else if (a < 0 && b < 0 && sum>0) {
            flag = false;
        }
        else if (sum > c) {
            flag = true;
        }
        else {
            flag = false;
        }

        if (flag) {
            printf("Case #%d: true\n", i);
        }
        else {
            printf("Case #%d: false\n", i);
        }
    }
    return 0;
}

相关文章

网友评论

      本文标题:1065 A+B and C (64bit)

      本文链接:https://www.haomeiwen.com/subject/ckcvbjtx.html