1065. A+B and C (64bit) (20)

时间限制
100 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
HOU, Qiming

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:

3
1 2 3
2 3 4
9223372036854775807 -9223372036854775808 0

Sample Output:

Case #1: false
Case #2: true
Case #3: false
#include <cstdio>
int main(){
long long a, b, c;//必须用long long 存储abc
int T, num = 0;
bool flag;
scanf("%d", &T);
while (T--)
{
scanf("%lld%lld%lld", &a, &b, &c);
long long t = a + b;
if (a > 0 && b > 0 && t < 0) flag = true; //正溢出
else if (a < 0 && b < 0 && t >= 0) flag = false;//负溢出
else if (t > c) flag = true; //未溢出
else flag = false;
num++;
if (flag) printf("Case #%d: true\n",num);
else printf("Case #%d: false\n", num); }
return 0;
}

PATA 1065 A+B and C (64bit)的更多相关文章

  1. PAT 1065 A+B and C (64bit) (20)

    1065. A+B and C (64bit) (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 HOU, Qiming G ...

  2. PAT 1065 A+B and C (64bit)

    1065 A+B and C (64bit) (20 分)   Given three integers A, B and C in [−], you are supposed to tell whe ...

  3. 1065 A+B and C (64bit) (20 分)

    1065 A+B and C (64bit) (20 分) Given three integers A, B and C in [−2^​63​​,2​^63​​], you are suppose ...

  4. pat 甲级 1065. A+B and C (64bit) (20)

    1065. A+B and C (64bit) (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 HOU, Qiming G ...

  5. pat 1065 A+B and C (64bit)(20 分)(大数, Java)

    1065 A+B and C (64bit)(20 分) Given three integers A, B and C in [−2​63​​,2​63​​], you are supposed t ...

  6. PAT 甲级 1065 A+B and C (64bit) (20 分)(溢出判断)*

    1065 A+B and C (64bit) (20 分)   Given three integers A, B and C in [−], you are supposed to tell whe ...

  7. PAT甲级——1065 A+B and C (64bit)

    1065 A+B and C (64bit) Given three integers A, B and C in [−2​63​​,2​63​​], you are supposed to tell ...

  8. PAT 甲级 1065. A+B and C (64bit) (20) 【大数加法】

    题目链接 https://www.patest.cn/contests/pat-a-practise/1065 思路 因为 a 和 b 都是 在 long long 范围内的 但是 a + b 可能会 ...

  9. ZJU-PAT 1065. A+B and C (64bit) (20)

    Given three integers A, B and C in [-263, 263], you are supposed to tell whether A+B > C. Input S ...

随机推荐

  1. Linux性能测试 dmesg命令

    dmesg 命令主要用来显示内核信息.使用 dmesg 可以有效诊断机器硬件故障或者添加硬件出现的问题.  另外,使用 dmesg 可以确定您的服务器安装了那些硬件.每次系统重启,系统都会检查所有硬件 ...

  2. UVA 10641 - Barisal Stadium(DP + 几何)

    题目链接:10641 - Barisal Stadium 题意:逆时针给定n个点,在给m个灯,每一个灯有一个花费,要求最小花费使得全部边能被灯照到 思路:用向量叉积推断向量的顺逆时针关系,从而预处理出 ...

  3. WPF使用DynamicDataDisplay.dll显示CPU及内存使用曲线

    原文:WPF使用DynamicDataDisplay.dll显示CPU及内存使用曲线 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/wangshub ...

  4. angular form set dynamic control(form动态设置control)

    实现效果 form表单控件的实时更新 效果如图 关键代码 validateForm: FormGroup; // 表单校验 constructor( private fb: FormBuilder ) ...

  5. asp .net 大文件传输配置

    asp .net config配置 需要在配置文件里面设置文件上传限定的两个属性值:maxAllowedContentLength,maxRequestLength 允许上传文件的长度,和请求的长度, ...

  6. 毫秒数据字符串转换为DateTime

    思路:取出毫秒结果,在1970年1月1日 00:00:00的基础上,加上毫秒数 string date = "/Date(1486363695453)/"; date = date ...

  7. MIME映射(程序映射)

    MIME(Multipurpose Internet Mail Extensions)多用途互联网邮件扩展类型.是设定某种扩展名的文件用一种应用程序来打开的方式类型,当该扩展名文件被访问的时候,浏览器 ...

  8. Linux IO模式

    原文地址:https://segmentfault.com/a/1190000003063859 同步IO和异步IO,阻塞IO和非阻塞IO分别是什么,到底有什么区别?不同的人在不同的上下文下给出的答案 ...

  9. WPF中的PathAnimation(路径动画)

    原文:WPF中的PathAnimation(路径动画) WPF中的PathAnimation(路径动画)                                                 ...

  10. iOS判断当前时间是否处于某个时间段内

    /** * 判断当前时间是否处于某个时间段内 * * @param startTime 开始时间 * @param expireTime 结束时间 */ - (BOOL)validateWithSta ...