1011 A + B and C (15 minutes)

Given interval [ -] in the three integers  A, B and  C, determines please  A + if B is greater than  C.

Input formats:

The first input line is given positive integer  T ( ≤), the test case number. Given later  T set of test cases, each per line, in the order given  A, B, and  C. Between integer separated by a space.

Output formats:

For each test case, the output line  Case #X: true if  A + B > C, otherwise the output  Case #X: false, which  X is the test case number (starting from 1).

Sample input:

4
1 2 3
2 3 4
2147483647 0 2147483646
0 -2147483648 -2147483647

Sample output:

Case #1: false
Case #2: true
Case #3: true
Case #4: false


 1 #include <stdio.h>
 2 
 3 int main(){
 4     int t;
 5     long long a[10],b[10],c[10];
 6     scanf("%d",&t);
 7     int i;
 8     for(i=0;i<t;i++){
 9         scanf("%lld%lld%lld",&a[i],&b[i],&c[i]);
10     }
11     for(i=0;i<t;i++){
12         if(a[i]+b[i]>c[i]){
13             printf("Case #");
14             printf("%d",i+1);
15             printf(": true\n");
16         }
17         else{
18             printf("Case #");
19             printf("%d",i+1);
20             printf(": false\n");
21         }
22     }
23     return 0;
24 }

 

Guess you like

Origin www.cnblogs.com/TBhacker/p/11166123.html