判断两数相加是否大于第三数,大于输出true,否则输出false(相等也是false)

1 需要注意数字溢出的问题;

2 先判断溢出,因为在a,b都是负数最小值的情况下,相加直接是正数,在c较小的时候会导致结果出错。

 #include<cstdio>
#include<iostream>
using namespace std;
int main(){
long long a,b,c;
long long sum;
int n,res;
scanf("%d",&n);
for(int i=;i<=n;i++){
scanf("%lld%lld%lld",&a,&b,&c);
sum=a+b;
if(a>&&b>&&sum<) res=;
else if(a<&&b<&&sum>=) res=;
else if(sum>c) res=;
else res=;
if(res==) printf("Case #%d: true\n", i);
else printf("Case #%d: false\n", i);
}
return ;
}

A1065的更多相关文章

  1. A1065 A+B and C (64bit) (20)(20 分)

    A1065 A+B and C (64bit) (20)(20 分) Given three integers A, B and C in [-2^63^, 2^63^], you are suppo ...

  2. A1065. A+B and C (64bit)

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

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

    AC代码 #include <cstdio> int main() { #ifdef ONLINE_JUDGE #else freopen("1.txt", " ...

  4. PAT甲级——A1065 A+B and C (64bit)

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

  5. PAT/简单模拟习题集(二)

    B1018. 锤子剪刀布 (20) Discription: 大家应该都会玩"锤子剪刀布"的游戏:两人同时给出手势,胜负规则如图所示: 现给出两人的交锋记录,请统计双方的胜.平.负 ...

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

  7. PAT题目AC汇总(待补全)

    题目AC汇总 甲级AC PAT A1001 A+B Format (20 分) PAT A1002 A+B for Polynomials(25) PAT A1005 Spell It Right ( ...

  8. PAT甲级题解分类byZlc

    专题一  字符串处理 A1001 Format(20) #include<cstdio> int main () { ]; int a,b,sum; scanf ("%d %d& ...

随机推荐

  1. Unity Mathf And Transform Compent(一)

    Mathf类部分变量 辐射到度的转化函数,能够将弧度转化成度. Abs 能够求出绝对值 Atan 求出正切值x/y的弧度 Transform 组件中带有local 以父物体为坐标原点 global以世 ...

  2. C语言实现单链表

    大二学习数据结构和算法啦,因为之前用Java语言实现过,所以理解起来还是比较轻松,就是理解指针与结构体的运用.废话不多说,上代码! 初始化 typedef struct Node { int data ...

  3. 爬虫二之Requests

    requests 实例引入 import requests response = requests.get('https://www.baidu.com') response.status_code ...

  4. Ubuntu 16.04 设置静态IP 注意事项

    目录 查看动态ip下的网络信息 查看默认网关 设置静态网络 查看动态ip下的网络信息 1 ifconifg # 查看网卡信息: 可以看出网口名称为 eno1, 以及子网掩码(mask) 查看默认网关 ...

  5. 利用coverage工具进行Python代码覆盖率测试

    Coverage是一种用于统计Python代码覆盖率的工具,通过它可以检测测试代码对被测代码的覆盖率情况. Coverage安装 1.安装命令:pip install coverage 2.查看cov ...

  6. PostgreSQL dblink使用过程

    安装: 进入/root/postgresql-11.2/contrib/dblink make && make install 切换到postgres用户 [root@fce40690 ...

  7. Windows 下安装 ElasticSearch 修改 elasticsearch.yml的坑

    注意:  ElasticSerach 集成 IK分词器 的时候,整个路径不能有空格!!! 1. 文件后加入 严格复制粘贴,否则入坑 http.cors.enabled : true http.cors ...

  8. JS跨域--window.name

    JS跨域--window.name:https://www.jianshu.com/p/43ff69d076e3

  9. [2019徐州网络赛J题]Random Access Iterator

    题目链接 大致题意:从根节点出发,在节点x有son[x]次等概率进入儿子节点,求到达最深深度的概率.son[x]为x节点的儿子节点个数. 又又又又没做出来,心态崩了. 下来看了官方题解后发觉自己大体思 ...

  10. C++基础-多态

    本文为 C++ 学习笔记,参考<Sams Teach Yourself C++ in One Hour a Day>第 8 版.<C++ Primer>第 5 版.<代码 ...