1 题目
2 代码
import java.util.Scanner;
public class B1011 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
long[] A = new long[T];
long[] B = new long[T];
long[] C = new long[T];
for (int i = 0; i < T; i++) {
A[i] = sc.nextLong();
B[i] = sc.nextLong();
C[i] = sc.nextLong();
}
for (int i = 0; i < T; i++) {
boolean res = (A[i] + B[i]) > C[i];
System.out.println("Case #" + (i + 1) + ": " + res);
}
}
}
3 要点
(1)int类型的数据范围是
[
−
2
31
,
2
31
]
[-2^{31},2^{31}]
[−231,231],所以不能用来解本题,故直接用long类型。(采用
A
−
C
+
B
A-C+B
A−C+B的策略同样不行)
(2)