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的更多相关文章

  1. PAT 1011

    1011. World Cup Betting (20) With the 2010 FIFA World Cup running, football fans the world over were ...

  2. PAT 1011 World Cup Betting

    1011 World Cup Betting (20 分)   With the 2010 FIFA World Cup running, football fans the world over w ...

  3. 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),是测试用例的个 ...

  4. pat 1011 World Cup Betting(20 分)

    1011 World Cup Betting(20 分) With the 2010 FIFA World Cup running, football fans the world over were ...

  5. PAT 1011. A+B和C (15)

    给定区间[-231, 231]内的3个整数A.B和C,请判断A+B是否大于C. 输入格式: 输入第1行给出正整数T(<=10),是测试用例的个数.随后给出T组测试用例,每组占一行,顺序给出A.B ...

  6. 浙大pat 1011题解

    With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...

  7. PAT——1011. A+B和C

    给定区间[-231, 231]内的3个整数A.B和C,请判断A+B是否大于C. 输入格式: 输入第1行给出正整数T(<=10),是测试用例的个数.随后给出T组测试用例,每组占一行,顺序给出A.B ...

  8. PAT 1011 World Cup Betting 查找元素

    With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excite ...

  9. PAT 1011 World Cup Betting (20分) 比较大小难度级别

    题目 With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly exc ...

随机推荐

  1. 泰泽智能电视(Tizen smart TV)问世

        6月2日至4日,泰泽开发人员大会(TDC)在美国洛杉矶举行,会上韓国三星公司展出了一台泰泽智能电视(原型机).        智能电视(Smart TV not to be confused ...

  2. python Polygon模块安装

    pip install Polygon这样会安装不了 只能使用pip install Polygon2 或者 pip install Polygon3,也就是必须带版本号

  3. Matlab使用技巧

    (1) Matlab强制退出正在运行的程序A: Ctrl + C(2)如何让Matlab跑完程序后自动关机?A: 在程序的末尾加上一条代码:    system('shutdown -s')   当然 ...

  4. PAT A1097 Deduplication on a Linked List (25 分)——链表

    Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated ...

  5. PAT A1134 Vertex Cover (25 分)——图遍历

    A vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at le ...

  6. springMVC中上传图片

    上传图片,很常见的问题,基本每个人都会遇到,但是个人认为在springMVC中上传图片相对来说是比较简单的,因为框架已经帮我们做好了许多事情. 这篇文章所用的环境:spring4.3.3 .jdk1. ...

  7. LVDS接口分类,时序,输出格式

    LVDS接口分类,时序,输出格式 2016年01月19日 16:57:35 打个飞机去美国 阅读数:24673 标签: LVDS液晶屏格式时序 更多 个人分类: 硬件基础   1.1.1        ...

  8. svg画弧

    http://www.pindari.com/svg-arc.html https://jsfiddle.net/8robssa0/ http://jsbin.com/giyotacuxu/edit? ...

  9. POJ1850&&1019&&1942

    这三道题都水的难以想象,所以就放在一起写 1850 题目大意:有一种一种序列排列方式(如同题目中给出的例子),然后给你一个序列,问你这个序列的排名 首先我们先判断无解的情况,这个就很简单了. 由于题目 ...

  10. [JSOI2016]无界单词[动态规划、kmp]

    题意 题目链接 分析 对于第一问,枚举最终串最小的相同前后缀来统计答案. 由于最小的相同前后缀也是无界单词,所以可以考虑先求解子问题. 定义状态 \(f(i)\) 表示长度为 \(i\) 的串中有多少 ...