Given interval [−2​^31​​,2^​31​​] Internal 3 An integer  A,B  and  C, Please judge  A+B  Is it greater than  C.

Input format :

Enter page 1 Row gives a positive integer  T (≤10), Is the number of test cases . It is given later  T  Group test cases , Each group has one line , The order is given  A,B  and  C. Integers are separated by spaces .

Output format :

Test cases for each group , Output in one line  Case #X: true  If  A+B>C, Otherwise output  Case #X: false, among  X  Is the number of the test case ( from 1
start ).

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
【 thinking 】

① I do it according to the input format given by the title , I think most of the other bloggers are like this : Each input line is judged and then output , Strangely enough, it passed the test .

② because 3 An integer has been given an interval [−2​^31​​,2^​31​​]
, You have to be careful about that , General int(2^31-1) It can't be satisfied ,long(2^31-1) It's not going to work . You can only choose long long (2^63-1) 
that's enough . But during the test , For discovery int There is a test point that can't pass , use long If you don't have a problem . I feel that this question is not rigorous .

③ I first save all the input data into a one-dimensional array , Then print according to the output format , data processing .

 

Attach the test code :
#include <stdio.h> int main() { printf("short occupy %d Bytes \n",sizeof(short));
printf("int occupy %d Bytes \n",sizeof(int)); printf("long occupy %d Bytes \n",sizeof(long));
printf("long long occupy %d Bytes \n\n\n",sizeof(long long)); printf("unsigned short
occupy %d Bytes \n",sizeof(unsigned short)); printf("unsigned int
occupy %d Bytes \n",sizeof(unsigned int)); printf("unsigned long
occupy %d Bytes \n",sizeof(unsigned long)); printf("unsigned long
long occupy %d Bytes \n",sizeof(unsigned long long)); return 0; }
 

【 Reference code 】
#include <stdio.h> int main() { int n;/ Number of rows to test long
array[30];// Each row of data is stored in this array ,30= Each line has 3 An integer *10 that 's ok int i=0,j=0;//j It's used to print line numbers char
ch;// To save spaces and newlines scanf("%d",&n); for(i=0;i<3*n;) { do {
scanf("%lld",&array[i++]); ch=getchar(); } while(ch!='\n'); }// Data input completed
for(i=0;i<=(3*n-3);i+=3)// data processing { printf("Case #%d: ",(++j));//j It's used to print line numbers
if((array[i]+array[i+1])>(array[i+2])) printf("true\n"); else
printf("false\n"); } return 0; }

 

Technology