Subject description:
Given interval is an integer of 3 A, B and C [-2 ^ 1, 2 ^ 31] in, please determines whether A + B is greater than C. Input format: Enter line 1 gives a positive integer T (≤10), are the number of test cases. T is then given set of test cases, each per line, the order is given A, B and C. Between integer separated by a space. Output format: for each test case, the output in line Case #X: true if A + B> C, otherwise the output Case #X: false, where X is the test case number (starting from 1). Sample input: . 4 . 1. 3 2 2. 4. 3 2147483647 2147483646 0 0-2147483648 -2147483647 Output Sample: Case #. 1: to false Case # 2: to true Case #. 3: to true Case #. 4: to false
I AC Code:
// 比较大小 # include <stdio.h> int main(void) { long long A[10]; long long B[10]; long long C[10]; int i; int n; // 输入数据 scanf("%d",&n); for (i=0; i<n; i++) { scanf("%ld",&A[i]); scanf("%ld",&B[i]); scanf("%ld",&C[i]); } // 比较大小 for (i=0; i<n; i++) { printf("Case #%d: ",i+1); if (A[i]+B[i] > C[i]) { printf("true\n"); } else { printf("false\n"); } } return 0; }
RRR