题目翻译:
大整数相加,比较大小
题解思路:
要考虑越界的问题,不越界的情况下正常比较大小即可
代码:
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
int main()
{
int N;
cin >> N;
for (int i = 0;i < N;i++){
LL a, b, c;
cin >> a >> b >> c;
long long int res = a + b;
if (a < 0 && b < 0 && res >= 0)
cout << "Case #" << i + 1 << ": false" << endl;
else if (a > 0 && b > 0 && res <= 0)
cout << "Case #" << i + 1 << ": true" << endl;
else if (res > c)
cout << "Case #" << i + 1 << ": true" << endl;
else
cout << "Case #" << i + 1 << ": false" << endl;
}
}
坑点:
无