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 ...
随机推荐
- MongoDB $关键字 关系比较符号 $lt $lte $gt $gte $ne
关系比较符: 小于:$lt 小于或等于:$lte 大于:$gt 大于或等于:$gte 不等于:$ne 属于:$in 查询中常见的 等于 大于 小于 大于等于 小于等于 等于 : 在MongoDB中什么 ...
- nginx cookie 丢失问题
- java之jedis使用
下载 依赖jar包下载 使用 # Redis settings redis.host=192.168.208.153 redis.port=6379 redis.pass=1234 redis.tim ...
- [js]设计模式小结&对原型的修改
js设计模式小结 工厂模式/构造函数--减少重复 - 创建对象有new - 自动创建obj,this赋值 - 无return 原型链模式 - 进一步去重 类是函数数据类型,每个函数都有prototyp ...
- JavaScript 事件之event.preventDefault()与event.stopPropagation()简单介绍
event.preventDefault()用法介绍: 该方法将通知 Web 浏览器不要执行与事件关联的默认动作(如果存在这样的动作). 例如,如果 type 属性是 “submit”,在事件传播的任 ...
- tp 内置压缩文件zip
一.解压缩zip文件 $zip = new ZipArchive;//新建一个ZipArchive的对象 /* 通过ZipArchive的对象处理zip文件 $zip->open这个方法的参数表 ...
- WebForm内置对象:Session、Cookie,登录和状态保持
1.Request -获取请求对象 string s =Request["key"]; 2.Response - 响应请求对象 Response.Redirect(" ...
- Shell脚本:while read line无法读取最后一行的问题
[1]Shell脚本:while read line无法读取最后一行的问题 刚刚利用shell脚本处理日志文件时,发现了一个问题:while read line无法读取到最后一行 通过编辑器可以看到待 ...
- [转载]SMTP的几个端口的比较
出处:https://blog.csdn.net/zhangyuan12805/article/details/78781330 1. SMTP Port 25: 25口是四个端口中最老的.这是在33 ...
- k-means算法 - 数据挖掘算法(5)
(2017-05-02 银河统计) k-means算法,也被称为k-平均或k-均值,是数据挖掘技术中一种广泛使用的聚类算法. 它是将各个聚类子集内的所有数据样本的均值作为该聚类的代表点,算法的主要思想 ...