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

Given three integers A, B and C in [−], 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 (≤). 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:

  1. 3
  2. 1 2 3
  3. 2 3 4
  4. 9223372036854775807 -9223372036854775808 0

Sample Output:

  1. Case #1: false
  2. Case #2: true
  3. Case #3: false
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4.  
  5. int main(){
  6. int t;
  7. cin >> t;
  8. int cnt = ;
  9. while(t--){
  10. bool flag=;
  11. ll a,b,c;cin >> a >> b >> c;
  12. ll res = a+b;
  13. if(a>&&b>&&res<){ // 正溢出
  14. flag=;
  15. }
  16. else if(a<&&b<&&res>=){ //负溢出是大于等于0
  17. flag=;
  18. }
  19. else if(res > c){
  20. flag=;
  21. }
  22. else if(res <= c){
  23. flag=;
  24. }
  25. if(flag){
  26. printf("Case #%d: true\n",cnt++);
  27. }
  28. else{
  29. printf("Case #%d: false\n",cnt++);
  30. }
  31. }
  32.  
  33. return ;
  34. }

基本想不到溢出吧。。还有注意>=0;

  1.  

PAT 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)(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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. PAT 1065 - 1068 题解

    这次的题目来源是 2013 年 10 月 7 日下午的浙大计算机研究生招生机试题. 这次题目的难度,按姥姥的说法是:『比普通的 PAT 要难了 0.5 个点.我是把自己的题目从 1.0 到 5.0 以 ...

  7. PAT 1065 1066 1067 1068

    pat 1065 A+B and C                                          主要是注意一下加法溢出的情况,不要试图使用double,因为它的精度是15~16 ...

  8. 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 ...

  9. PAT 1065 A+B and C[大数运算][溢出]

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

随机推荐

  1. MongoDB $关键字 关系比较符号 $lt $lte $gt $gte $ne

    关系比较符: 小于:$lt 小于或等于:$lte 大于:$gt 大于或等于:$gte 不等于:$ne 属于:$in 查询中常见的 等于 大于 小于 大于等于 小于等于 等于 : 在MongoDB中什么 ...

  2. nginx cookie 丢失问题

  3. java之jedis使用

    下载 依赖jar包下载 使用 # Redis settings redis.host=192.168.208.153 redis.port=6379 redis.pass=1234 redis.tim ...

  4. [js]设计模式小结&对原型的修改

    js设计模式小结 工厂模式/构造函数--减少重复 - 创建对象有new - 自动创建obj,this赋值 - 无return 原型链模式 - 进一步去重 类是函数数据类型,每个函数都有prototyp ...

  5. JavaScript 事件之event.preventDefault()与event.stopPropagation()简单介绍

    event.preventDefault()用法介绍: 该方法将通知 Web 浏览器不要执行与事件关联的默认动作(如果存在这样的动作). 例如,如果 type 属性是 “submit”,在事件传播的任 ...

  6. tp 内置压缩文件zip

    一.解压缩zip文件 $zip = new ZipArchive;//新建一个ZipArchive的对象 /* 通过ZipArchive的对象处理zip文件 $zip->open这个方法的参数表 ...

  7. WebForm内置对象:Session、Cookie,登录和状态保持

    1.Request -获取请求对象 string s =Request["key"]; 2.Response  -  响应请求对象 Response.Redirect(" ...

  8. Shell脚本:while read line无法读取最后一行的问题

    [1]Shell脚本:while read line无法读取最后一行的问题 刚刚利用shell脚本处理日志文件时,发现了一个问题:while read line无法读取到最后一行 通过编辑器可以看到待 ...

  9. [转载]SMTP的几个端口的比较

    出处:https://blog.csdn.net/zhangyuan12805/article/details/78781330 1. SMTP Port 25: 25口是四个端口中最老的.这是在33 ...

  10. k-means算法 - 数据挖掘算法(5)

    (2017-05-02 银河统计) k-means算法,也被称为k-平均或k-均值,是数据挖掘技术中一种广泛使用的聚类算法. 它是将各个聚类子集内的所有数据样本的均值作为该聚类的代表点,算法的主要思想 ...