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. string操作

    常用的功能测试: #! -*- coding:utf-8 -*- import string s = 'Yes! This is a string' print '原字符串:' + s print ' ...

  2. 简明Python3教程 8.控制流

    简介 迄今为止我们见到的所有程序总是含有一连串语句并且python忠实的顺序执行它们. 那么如何改变它们的执行顺序呢?例如你希望程序根据不同情况作出不同反应,按照当前时间分别 打印出’Good Mor ...

  3. Linux性能测试 tcpdump命令

    用简单的话来定义tcpdump,就是:dump the traffic on a network,根据使用者的定义对网络上的数据包进行截获的包分析工具. tcpdump可以将网络中传送的数据包的“头” ...

  4. SecureCRT自动登录Linux并设置时间

    #$language = "VBScript" #$interface = "1.0" crt.Screen.Synchronous = True ' This ...

  5. 【iOS发展-89】UIGestureRecognizer完整的旋转手势识别、缩放和拖拽等效果

    (1)效果 (2)代码 http://download.csdn.net/detail/wsb200514/8261001 (3)总结 --先依据所需创建不同类型的手势识别.比方: UITapGest ...

  6. html5 命运之轮生产

    码,如以下: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEn ...

  7. EntityFrameworkCore 一对一 && 一对多 && 多对多配置

    基本数据结构 表设计如下: 入学记录 public class AdmissionRecord { [Key] public long Id { get; set; } public DateTime ...

  8. 2-17-MySQL读写分离-mysql-proxy

        实验环境: mysql-proxy服务端:        xuegod1              IP:192.168.10.31 mysql服务器(主,负责写)服务端:xuegod2    ...

  9. MVC基架生成的Index视图

    @model IEnumerable<MyMusicStore.Models.Album> @{     ViewBag.Title = "Index"; } < ...

  10. WPF 多路绑定

    using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...