1065 A+B and C (64bit) (20 分)
Given three integers A, B and C in [−2^63,2^63], you are supposed to tell whether A+B>C.
Input Specification:
The first line of the input gives the positive number of test cases, T (≤10). Then T test cases follow, each consists of a single line containing three integers A, B and C, separated by single spaces.
Output Specification:
For each test case, output in one line Case #X: true
if A+B>C, or Case #X: false
otherwise, where X is the case number (starting from 1).
Sample Input:
31 2 32 3 49223372036854775807 -9223372036854775808 0
Sample Output:
Case #1: falseCase #2: trueCase #3: false 分析:这个题有坑点,涉及到计算机组成原理的知识,数字的范围是[−2^63,2^63], 而long long 的范围是[-2^63,2^63),两个数相加会溢出,符号位会取反。
1 /** 2 * Copyright(c) 3 * All rights reserved. 4 * Author : Mered1th 5 * Date : 2019-02-23-19.49.08 6 * Description : A1065 7 */ 8 #include9 #include 10 #include 11 #include 12 #include 13 #include 14 #include 15 #include