PAT甲级——1065 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 Specification:
The first line of the input gives the positive number of test cases, T (≤10). 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 <cstdio>
int main(){
int n,i;
long long int a,b,c;
scanf("%d",&n);
for(i=1;i<=n;++i){
bool flg = true;
scanf("%lld %lld %lld",&a,&b,&c);
long long res = a+b;
if(a>0 && b>0 && res<=0)flg = true;
else if(a<0 && b<0 && res>=0)flg = false;
else{
if(res<=c)flg = false;
}
if(flg){
printf("Case #%d: true\n",i);
}else{
printf("Case #%d: false\n",i);
}
}
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 分)(溢出判断)*
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) (20) 【大数加法】
题目链接 https://www.patest.cn/contests/pat-a-practise/1065 思路 因为 a 和 b 都是 在 long long 范围内的 但是 a + b 可能会 ...
- PAT——甲级1065:A+B and C(64bit) 乙级1010一元多项式求导
甲级1065 1065 A+B and C (64bit) (20 point(s)) Given three integers A, B and C in [−263,263], you ...
- PAT A 1065. A+B and C (64bit) (20)
题目 Given three integers A, B and C in [-263, 263], you are supposed to tell whether A+B > C. Inpu ...
- pat(A) 1065. A+B and C (64bit) (java大数)
代码: import java.util.*; import java.math.*; public class Main { public static void main(String args[ ...
- PAT Advanced 1065 A+B and C (64bit) (20 分)(关于g++和clang++修改后能使用)
Given three integers A, B and C in [−], you are supposed to tell whether A+B>C. Input Specificati ...
- 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 ...
- 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 ...
随机推荐
- 微信小程序下载图片到本地
downloadImg: function(e){ //触发函数 console.log(e.currentTarget.dataset.url) wx.downloadFile({ url: e.c ...
- Jackknife,Bootstrap, Bagging, Boosting, AdaBoost, RandomForest 和 Gradient Boosting的区别
Bootstraping: 名字来自成语“pull up by your own bootstraps”,意思是依靠你自己的资源,称为自助法,它是一种有放回的抽样方法,它是非参数统计中一种重要的估计统 ...
- HTML5 Canvas——折线图
<script type="text/javascript"> /*1.绘制网格 网格大小 10px 网格的颜色 #ddd */ /*2.绘制坐标 轴的离边距离 20p ...
- CSU 1425 NUDT校赛 I题 Prime Summation
这个题本来有希望在比赛里面出了的 当时也想着用递推 因为后面的数明显是由前面的推过来的 但是在计算的时候 因为判重的问题 ...很无语.我打算用一个tot[i]来存i的总种树,tot[i]+=tot[ ...
- 代码杂谈-SQL中的rank&row_number函数
两个函数细节记不住. 写个例子备注一下. select no, name, score , rank() over(partition by no order by score asc) rk1 , ...
- SQL基础教程(第2版)第8章 SQL高级处理:8-2 GROUPING运算符
第8章 SQL高级处理:8-2 GROUPING运算符 ■ GROUPING SETS——取得期望的积木● 只使用GROUP BY子句和聚合函数是无法同时得出小计和合计的.如果想要同时得到,可以使用G ...
- 解决 springweb Filter 读取request body miss body
package com.lb.demo.listener; import java.io.BufferedReader; import java.io.ByteArrayInputStream; im ...
- Thread--synchronized不能被继承?!?!!!
参考:http://bbs.csdn.net/topics/380248188 其实真相是这样的,“synchronized不能被继承”,这句话有2种不同意思,一种是比较正常的.很容易让人想到的意思: ...
- 细说opcache
; opcache的开关,关闭时代码不再优化. opcache.enable=1 ; Determines if Zend OPCache is enabled for the CLI version ...
- pandas在指定列插入数据
import pandas as pd import numpy as np df = pd.DataFrame(np.arange(15).reshape(5, 3), columns=['a', ...