1065. A+B and C (64bit) (20)

本文介绍了一个简单的编程挑战,任务是判断三个给定整数A、B和C是否满足A+B>C的条件。文章提供了两种不同的实现方法,并通过样例输入输出展示了程序的功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1065. A+B and C (64bit) (20)
时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B
判题程序 Standard 作者 HOU, Qiming

Given three integers A, B and C in [-263, 263], you are supposed to tell whether A+B > C.
Input Specification:
The first line of the input gives the positive number of test cases, T (<=10). Then T test cases follow, each consists of a single line containing three integers A, B and C, separated by single spaces.
Output Specification:
For each test case, output in one line “Case #X: true” if A+B>C, or “Case #X: false” otherwise, where X is the case number (starting from 1).
Sample Input:
3
1 2 3
2 3 4
9223372036854775807 -9223372036854775808 0
Sample Output:
Case #1: false
Case #2: true
Case #3: false

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

int main()
{
#ifdef _DEBUG
    ifstream cin("data.txt");
#endif // _DEBUG

    long long A, B, C ,res;
    int n,flag;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> A >> B >> C;
        res = A + B;
        if (A > 0 && B > 0 && res <= 0)flag = 1;//上溢
        else if (A < 0 && B < 0 && res >= 0)flag = 0;//下溢
        else if (res > C)flag = 1;
        else flag = 0;
        cout << "Case #" << i << ((flag) ? (": true") : (": false")) << endl;
    }


#ifdef _DEBUG
    cin.close();
    system("pause");
#endif // _DEBUG

    return 0;
}
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;

int main()
{
#ifdef _DEBUG
    ifstream cin("data.txt");
#endif // _DEBUG


        int T;    
        cin >> T;   
        for (int i = 1; i <= T; ++i) 
        { 
            long double a, b, c, ans;    
            cin >> a >> b >> c;  
            cout << "Case #" << i << ": " << (a + b>c ? "true" : "false") << endl;
        }


#ifdef _DEBUG
    cin.close();
    system("pause");
#endif // _DEBUG

    return 0;
}
Error: Problem: package policycoreutils-python-utils-2.9-19.el8.noarch requires /usr/libexec/platform-python, but none of the providers can be installed - package container-selinux-2:2.179.1-1.module+el8.6.0+785+d1251653.noarch requires policycoreutils-python-utils, but none of the providers can be installed - package platform-python-3.6.8-45.el8.rocky.0.i686 requires python3-libs(x86-32) = 3.6.8-45.el8.rocky.0, but none of the providers can be installed - package platform-python-3.6.8-45.el8.rocky.0.i686 requires libpython3.6m.so.1.0, but none of the providers can be installed - package platform-python-3.6.8-45.el8.rocky.0.x86_64 requires libpython3.6m.so.1.0()(64bit), but none of the providers can be installed - package platform-python-3.6.8-45.el8.rocky.0.x86_64 requires python3-libs(x86-64) = 3.6.8-45.el8.rocky.0, but none of the providers can be installed - package containerd.io-1.6.28-3.1.el8.x86_64 requires container-selinux >= 2:2.74, but none of the providers can be installed - installed package python3-3.7.4-8.oe1.x86_64 obsoletes python3-libs provided by python3-libs-3.6.8-45.el8.rocky.0.i686 - installed package python3-3.7.4-8.oe1.x86_64 obsoletes python3-libs provided by python3-libs-3.6.8-45.el8.rocky.0.x86_64 - conflicting requests - problem with installed package python3-3.7.4-8.oe1.x86_64 - package container-selinux-2:2.124.0-1.gitf958d0c.module+el8.5.0+681+c9a1951f.noarch is excluded - package container-selinux-2:2.130.0-1.module+el8.5.0+770+e2f49861.noarch is excluded - package container-selinux-2:2.178.0-1.module+el8.6.0+784+32aef5de.noarch is excluded - package container-selinux-2:2.178.0-2.module+el8.6.0+783+10209741.noarch is excluded (try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
07-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值