判断两数相加是否大于第三数,大于输出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. 3D打印技术的学习

    1. 我们使用3D建模软件:123Ddesign来设计 123D design软件保存格式有2种,分别为123dx和stl格式 123dx格式:选择菜单栏中“Save”下的“To my compute ...

  2. Ubuntu新建用户以及安装pytorch

    环境:Ubuntu18,Python3.6 首先登录服务器 ssh username@xx.xx.xx.xxx #登录一个已有的username 新建用户 sudo adduser username ...

  3. Java中字母大小写的转换

    例:String str = "AbC"; 把字符串所有字母变成小写: System.out.println(str.toLowerCase()); 把字符串所有字母大写: Sys ...

  4. docker--docker仓库

    8 docker仓库 Docker仓库(Repository)类似与代码仓库,是Docker集中存放镜像文件的地方. 8.1 docker hub 1.打开https://hub.docker.com ...

  5. java学习day1

    一.常用的DOS命令 1.打开cmd 窗口键+r --> 输入cmd --> 确认 2.常用的dos命令 dir:列出当前目录下的所有文件及文件夹 md:创建一个新的目录 rd:删除目录 ...

  6. Qt 遍历不规则树的节点

    在使用Qt的GraphicsScene作图时,遇到类似这样的需求:在scene中创建节点类似下图, 现在我要把每个节点的txt保存到xml文件中,结构为 <?xml version='1.0' ...

  7. 题解 AT1357 【n^p mod m】

    此题就是快速幂取模 先简单讲一讲快速幂 首先,快速幂的目的就是做到快速求幂,假设我们要求a^b,按照朴素算法就是把a连乘b次,这样一来时间复杂度是O(b)也即是O(n)级别,快速幂能做到O(logn) ...

  8. Selenium1.0与2.0介绍

    Selenium的实现原理 首先,你要明确刚才建立的测试用例是基于Selenium 2.0,也就是Selenium + WebDriver的方案.其次,你需要知道,对Selenium而言,V1.0和V ...

  9. Python 入门之格式化输出

    Python 入门之格式化输出 1.格式化 (1)%为占位 (2)%s --- 站字符串的位置(数字.字符串都能够进行填充) name = input('请输入姓名:') age = input('请 ...

  10. 三、JVM — 类加载过程

    类加载过程 加载 验证 准备 解析 初始化 类加载过程 Class 文件需要加载到虚拟机中之后才能运行和使用,那么虚拟机是如何加载这些 Class 文件呢? 系统加载 Class 类型的文件主要三步: ...