Given three integers A, B and C in [−], 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 (≤). 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 Xis 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
1 #include <iostream> 2 using namespace std; 3 long long N, A, B, C, sum; 4 int main() 5 { 6 cin >> N; 7 for (int i = 1; i <= N; ++i) 8 { 9 cin >> A >> B >> C; 10 sum = A + B; 11 if (A > 0 && B > 0 && sum < 0)//正溢出 12 cout << "Case #" << i << ": " << "true" << endl; 13 else if (A < 0 && B < 0 && sum >= 0)//负溢出 14 cout << "Case #" << i << ": " << "false" << endl; 15 else if(sum>C) 16 cout << "Case #" << i << ": " << "true" << endl; 17 else 18 cout << "Case #" << i << ": " << "false" << endl; 19 } 20 return 0; 21 }