public class test {
public static void main(String[] args) {
int T;//输入第1行给出正整数T,是测试用例的个数。
String a,b,c;
Scanner sc=new Scanner(System.in);
T = sc.nextInt();
String arr[][] = new String[T][3];
for (int i = 0; i < T; i++) {
a = sc.next();//要存入大整数必须要用字符串来存入
b = sc.next();
c = sc.next();
arr[i][0] = a;//将接收的字符串存到数组
arr[i][1] = b;
arr[i][2] = c;
}
for (int i = 0; i < T; i++) {
BigInteger A = new BigInteger(arr[i][0]);//将数组中的数转为BigInteger型
BigInteger B = new BigInteger(arr[i][1]);
BigInteger C = new BigInteger(arr[i][2]);
int result = (A.add(B)).compareTo(C);//BigInteger的比较运算结果,返回的是-1,0,1
System.out.println("Case #" + (i + 1) + ": " + Compare(result));
}
}
public static boolean Compare(int result) {//将返回的三个数转换成boolean型
if (result == 1) {
return true;
}else {
return false;
}
}
}
运行结果: