哈理工软件学院第三届ACM编程决赛-高年级组A.A + B Is Overflow

https://ac.nowcoder.com/acm/contest/21#question
 

import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int T = scan.nextInt();
		long A, B;
		while (T-- != 0) {
			A = scan.nextLong();
			B = scan.nextLong();
			A = A + B;
			if (A <= -Math.pow(2, 31) || A >= Math.pow(2, 31))
				System.out.println("Yes");
			else
				System.out.println("No");
		}
	}
}

猜你喜欢

转载自blog.csdn.net/qq_39370495/article/details/89329020
今日推荐