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. Java中关于LockSupport的简单入门记录

    LockSupport的JDK的文档描述:Basic thread blocking primitives for creating locks and other synchronization c ...

  2. Jedis使用管道优化批量输出插入的效率

    Jedis连接池: package com.daxin.jedis_datastructure; /** * * @author daxin * * @email leodaxin@163com * ...

  3. Arduino IDE for ESP8266 项目(2)wifi扫描

    #include "ESP8266WiFi.h" void setup() { Serial.begin(115200); //设定WiFi为STA模式,如果先前已连接上AP,则与 ...

  4. Linux系统学习之正则表达式

    一.基础的正则表达式 1."."(一个点)符号 点符号用于U匹配除换行符号之外的任意一个字符.例如:r.t可以匹配rot.rut,但是不能匹配root,但如果使用r..t,就可以匹 ...

  5. [转]QT4.8.5+qt-vs-addin-1.1.11+VS2010安装配置和QT工程的新建和加载

    1.下载windows下的QT库 QT4.8.5 for vs2010: http://download.qt-project.org/official_releases/qt/4.8/4.8.5/q ...

  6. Google的Flutter工具允许开发者开发跨平台应用

    与大多数应用程序开发人员交谈,他们会告诉你,与iOS相比,制作Android应用程序要困难得多,也更复杂,也不那么有趣.实际上,如果你要求报价,这两种软件都将单独定价,因为它们都需要单独的开发时间和团 ...

  7. Linux系统远程连接服务器命令行模式

    导读 对于很多新手来说,如何用Windows远程Linux操作系统,是个前进的大问题.如果这个问题前进不了,其他更别说了. Linux或Max OS X系统电脑,登录步骤为 1.打开ssh客户端 2. ...

  8. DNS主从复制及区域传送

    前言 DNS主从复制,就是将主DNS服务器的解析库复制传送至从DNS服务器,进而从服务器就可以进行正向.反向解析了.从服务器向主服务器查询更新数据,保证数据一致性,此为区域传送.也可以说,DNS区域传 ...

  9. Omi框架学习之旅 - 通过omi-id来实现组件通讯 及原理说明

    这个demo是通过omi-id来获取子类的实例,然后更改data属性,之后updata一下就好了. 老规矩:先上demo代码, 然后提出问题, 之后解答问题, 最后源码说明. class Hello ...

  10. Spring Boot(十六):使用 Jenkins 部署 Spring Boot

    Jenkins 是 Devops 神器,本篇文章介绍如何安装和使用 Jenkins 部署 Spring Boot 项目 Jenkins 搭建.部署分为四个步骤: 第一步,Jenkins 安装 第二步, ...