1065 A+B and C (64bit) (20 point(s))
Given three integers A, B and C in [−263,263], 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:
Sample Output:
经验总结:
这一题,要注意,A+B是有可能溢出的,而我们恰恰可以利用溢出的特性来进行判断,比如A、B如果都大于0,A+B小于0,那么A+B一定大于C,因为C肯定没有溢出,其他的情况也是这个道理~
AC代码