今日头条的模拟题一直显示运行失败!!但是电脑上运行的好好的
这道题是今日头条的模拟题,为什么我用了BigInteger之后,会说运行失败的?我在电脑上运行的好好的~~!
下面是我的代码:
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int num = 1; BigInteger a1, b1, c1; while (n > 0) { a1 = new BigInteger(scan.nextInt() + ""); b1 = new BigInteger(scan.nextInt() + ""); c1 = new BigInteger(scan.nextInt() + ""); if ((a1.add(b1)).compareTo(c1) == 1) { System.out.println("Case #" + num + ": true"); } else { System.out.println("Case #" + num + ": false"); } n--; num++; } scan.close(); } }
有谁知道为什么吗???
#字节跳动#