PAT 1065 A+B and C (64bit)
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:
3
1 2 3
2 3 4
9223372036854775807 -9223372036854775808 0
Sample Output:
Case #1: false
Case #2: true
Case #3: false
#include<bits/stdc++.h>
using namespace std;
typedef long long ll; int main(){
int t;
cin >> t;
int cnt = ;
while(t--){
bool flag=;
ll a,b,c;cin >> a >> b >> c;
ll res = a+b;
if(a>&&b>&&res<){ // 正溢出
flag=;
}
else if(a<&&b<&&res>=){ //负溢出是大于等于0
flag=;
}
else if(res > c){
flag=;
}
else if(res <= c){
flag=;
}
if(flag){
printf("Case #%d: true\n",cnt++);
}
else{
printf("Case #%d: false\n",cnt++);
}
} return ;
}
基本想不到溢出吧。。还有注意>=0;
PAT 1065 A+B and C (64bit)的更多相关文章
- 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 ...
- pat 1065 A+B and C (64bit)(20 分)(大数, Java)
1065 A+B and C (64bit)(20 分) Given three integers A, B and C in [−263,263], you are supposed t ...
- 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 ...
- 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 ...
- PAT甲级——1065 A+B and C (64bit)
1065 A+B and C (64bit) Given three integers A, B and C in [−263,263], you are supposed to tell ...
- PAT 1065 - 1068 题解
这次的题目来源是 2013 年 10 月 7 日下午的浙大计算机研究生招生机试题. 这次题目的难度,按姥姥的说法是:『比普通的 PAT 要难了 0.5 个点.我是把自己的题目从 1.0 到 5.0 以 ...
- PAT 1065 1066 1067 1068
pat 1065 A+B and C 主要是注意一下加法溢出的情况,不要试图使用double,因为它的精度是15~16 ...
- 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 ...
- PAT 1065 A+B and C[大数运算][溢出]
1065 A+B and C (64bit)(20 分) Given three integers A, B and C in [−263,263], you are supposed t ...
随机推荐
- 在Windows Server 2008 R2 Server中,连接其他服务器的数据库遇到“未启用当前数据库的 SQL Server Service Broker,因此查询通知不受支持。如果希望使用通知,请为此数据库启用 Service Broker ”
项目代码和数据库部署在不同的Windows Server 2008 R2 Server中,错误日志显示如下: "未启用当前数据库的 SQL Server Service Broker,因此查 ...
- app优化篇
UIImageView高效加个圆角 一般通过clipsToBounds和layer.cornerRadius会强制Core Animation提前渲染屏幕的离屏绘制,影响性能. 通过贝塞尔曲线切割图片 ...
- 4、jeecg 笔记之 自定义显示按钮 (exp 属性)
1.需求 先看一下需求吧,我们希望 datagrid 操作栏中的按钮,可以根据条件进行动态显示. 2.实现 其实 jeecg 提供了一个属性 - exp ,通过该属性即可实现. <t:dgFun ...
- Spring Data JPA框架
1.前言 扔一个 spring data jpa 的代码,可运行,后续补充博客内容. 环境:eclipse + tomcat8 2.部分截图 3.源码 https://gitee.com/niceyo ...
- .net ML机器学习中遇见错误记录
避免入坑: 1.错误提示 numClasses must be at least 2 大概是训练模型的数据分类必须是两种,如下错误: 正确数据集如下:
- MySQL数据库基础备份
1.备份命令 格式:mysqldump -h主机名 -P端口 -u用户名 -p密码 --database 数据库名 > 文件名.sql mysqldump -h -uroot -ppasswor ...
- IntelliJ IDEA java文件注释模板
一.设置 二.注释模板 /*** @version: java version 1.7+* @Author : * @Explain :* @contact: * @Time : ${DATE} ${ ...
- day014 模块
# 1.用于多种语言交互 编程语言通用数据 # 内置的 不需要安装 直接导入使用 import json # 导入一个json模块 # dumps loads# dump load 有持久化的功能 # ...
- RabbitMQ:Docker环境下搭建rabbitmq集群
RabbitMQ作为专业级消息队列:如何在微服务框架下搭建 使用组件 文档: https://github.com/bijukunjummen/docker-rabbitmq-cluster 下载镜像 ...
- 蓝桥杯近三年初赛题之一(15年b组)
临近比赛,自己定时做了近三年的初赛题,不是很理想,10道题平均做对5+道.为了这次比赛,总共做了200题左右吧,估计去北京参加决赛有点难,不过不管怎样,对得起自己万余行代码就好. 一.15年初赛题(第 ...