今日头条的模拟题一直显示运行失败!!但是电脑上运行的好好的

   这道题是今日头条的模拟题,为什么我用了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();
	}
}
有谁知道为什么吗???
#字节跳动#
全部评论
数据超出范围了吗?试试,b大于0时比较a与c-b大小
点赞 回复 分享
发布于 2016-04-24 07:31
那说明人家不让用BigInteger
点赞 回复 分享
发布于 2016-04-23 16:31

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务