版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
题目
在有些方面,比如大整数的处理,不得不佩服Java,好用没的说,像开挂一样
题解 Java
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// 总行数
int total = Integer.parseInt(sc.nextLine());
// 两数相加 与第三个数比较
for (int i = 0; i < total; i++) {
String str = sc.nextLine();
String[] strArr = str.split(" ");
BigInteger big1 = new BigInteger(strArr[0]);
BigInteger big2 = new BigInteger(strArr[1]);
BigInteger big3 = new BigInteger(strArr[2]);
BigInteger sum = big1.add(big2);
if (sum.compareTo(big3) > 0) {// sum>big3
System.out.println("Case #" + (i + 1) + ": true");
} else {
System.out.println("Case #" + (i + 1) + ": false");
}
}
}
}