PAT 1011 A+B和C
https://pintia.cn/problem-sets/994805260223102976/problems/994805312417021952
给定区间[-2^31^, 2^31^]内的3个整数A、B和C,请判断A+B是否大于C。
输入格式:
输入第1行给出正整数T(<=10),是测试用例的个数。随后给出T组测试用例,每组占一行,顺序给出A、B和C。整数间以空格分隔。
输出格式:
对每组测试用例,在一行中输出“Case #X: true”如果A+B>C,否则输出“Case #X: false”,其中X是测试用例的编号(从1开始)。
输入样例:
4
1 2 3
2 3 4
2147483647 0 2147483646
0 -2147483648 -2147483647
输出样例:
Case #1: false
Case #2: true
Case #3: true
Case #4: false
代码:
#include <bits/stdc++.h> using namespace std; int sum(long long int a,long long int b,long long int c)
{
if(a+b>c)
return 1;
else
return 0;
} int main()
{
int T;
scanf("%d",&T);
for(int i=1;i<=T;i++)
{
long long int A,B,C;
scanf("%lld%lld%lld",&A,&B,&C);
cout<<"Case #"<<i<<": ";
if(sum(A,B,C)==1)
cout<<"true"<<endl;
else
cout<<"false"<<endl;
}
return 0;
}
PAT 1011 A+B和C的更多相关文章
- PAT 1011
1011. World Cup Betting (20) With the 2010 FIFA World Cup running, football fans the world over were ...
- PAT 1011 World Cup Betting
1011 World Cup Betting (20 分) With the 2010 FIFA World Cup running, football fans the world over w ...
- PAT 1011 A+B和C (15)(C++&JAVA&Python)
1011 A+B和C (15)(15 分) 给定区间[-2^31^, 2^31^]内的3个整数A.B和C,请判断A+B是否大于C. 输入格式: 输入第1行给出正整数T(<=10),是测试用例的个 ...
- pat 1011 World Cup Betting(20 分)
1011 World Cup Betting(20 分) With the 2010 FIFA World Cup running, football fans the world over were ...
- PAT 1011. A+B和C (15)
给定区间[-231, 231]内的3个整数A.B和C,请判断A+B是否大于C. 输入格式: 输入第1行给出正整数T(<=10),是测试用例的个数.随后给出T组测试用例,每组占一行,顺序给出A.B ...
- 浙大pat 1011题解
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...
- PAT——1011. A+B和C
给定区间[-231, 231]内的3个整数A.B和C,请判断A+B是否大于C. 输入格式: 输入第1行给出正整数T(<=10),是测试用例的个数.随后给出T组测试用例,每组占一行,顺序给出A.B ...
- PAT 1011 World Cup Betting 查找元素
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...
- PAT 1011 World Cup Betting (20分) 比较大小难度级别
题目 With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly exc ...
随机推荐
- dp 动态规划 之C - Apple Catching 简单基础
终于开始写dp了,还很不熟练 It is a little known fact that cows love apples. Farmer John has two apple trees (whi ...
- Http实现文件下载
HttpServlet实现下载文件,重要的设置header,否则浏览器无法解析为下载. Header示例: 1:response.setContentType("application/pd ...
- Python--Windows下安装虚拟环境
为什么需要虚拟环境 在python开发中,我们可能会遇到一种情况:就是当前的项目依赖的是某一个版本,但是另一个项目依赖的是另一个版本,这样就会造成依赖冲突.在这种情况之下,我们就需要一个工具能够将这两 ...
- gulp学习-metamask前端使用
https://www.gulpjs.com.cn/docs/getting-started/ ,这个是3.9.0版本 后面发现安装的版本是4.0.0,看下面这个: https://github.co ...
- WebService之nginx+(php-fpm)结构模型剖析及优化
随着php脚本语言使用的普及,目前webserice服务大部分都在用nginx+(php-fpm)的结构,了解了其工作过程后才可以在各个方面想办法做调整优化和故障排查,从以下几点总结一下这种模型. 一 ...
- Shell逻辑语句
case esac 语句 参考 :https://blog.csdn.net/wu20093346/article/details/47210809 case ... esac 与其他语言中的 swi ...
- 云主机被拿去挖矿,cpu暴涨,tcp连接突增
1.云主机被拿去挖矿,cpu暴涨,tcp连接突增 2.现象:top -c 3.然后我再查看pstree进程树 4.查找文件来源 ind / -name '*suppoie*' 5. 然后删除 sup ...
- TerraGate软件安装后,服务无法启动的解决方法
前些天有朋友问,TerraGate安装后,服务无法启动,而且启动按钮也是不可用的状态,不知道是为什么,如下图: 打开TerraGate的安装目录,发现里面缺少一些文件,如下图: *解决办法: 重新安装 ...
- webstorm破解汉化
一.下载webstorm软件和汉化包 webstorm安装包下载链接 : 链接: https://pan.baidu.com/s/1VmOPNVL2GRgAb_0tAJhy8A 密码: am7e 汉化 ...
- ionic 访问odoo11之具体业务类api接口
在前面测试通过odoo登录的功能,这次的问题重点是如何访问后台具体的业务类的接口呢?这次就以我们在odoo中安装的lunch模块为例,目标是获取lunch.alert的数据,如下图 具体过程接上次文章 ...