B1011. A + B and C

Title Description

  Given interval [-2 ^ 63, 2 ^ 63] three integers A, B and C in, please Analyzing A + B is greater than C

Input Format

  The first line gives a positive integer T (≤10), i.e., the number of test cases. T is then given set of test cases, each per line, the order is given A, B and C. Separated by a space between integer

Output Format

  For each test case, if A + B> C, output line "Case #X: true"; otherwise, outputs "Case #X: false", where X is the test case number (starting at 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 #3: false

The basic idea

Enter T, for the input data set represents the following, so that while the first few lines showing tacse, the initial value 1, for each data, determines whether or not A + B is greater than C, the output format corresponding to the result

    int T, row_num; // T is the number of test cases, row_num indicates the line number 
    Scanf ( " % D " , & n-);
     the while (- T) {
         Long  Long A, B, C; 
        Scanf ( " % LLD % LLD% LLD " , & A, & B, & C); 
         IF (A + B> C) { 
             the printf ( " Case #% D: to true \ n- " , TCASE ++ );      
        } the else { 
             the printf ( " Case #% D: false \ the n- " , TCASE ++ );      
        }
    }    
    return 0;

The key problem-solving

An integer ranging, [- 2 ^ 63, 2 ^ 63], int type data range [-2 ^ 63, 2 ^ 63--1], where the maximum value will exceed the range of type int i, must be used as long long ABC variable types

Guess you like

Origin www.cnblogs.com/YC-L/p/12089902.html