PAT (Basic Level) Practice (中文) B1011 A+B 和 C (15 分)

简介: PAT (Basic Level) Practice (中文) B1011 A+B 和 C (15 分)

给定区间 [−231 231] 内的 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;
using gg=long long;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T;
  int tcase=1;
  scanf("%d",&T);
  while(T--)
  {
    long long a,b,c;
    scanf("%lld %lld %lld",&a,&b,&c);
    if(a+b>c)
    {
      printf("Case #%d: true\n",tcase++);
    }else {
      printf("Case #%d: false\n",tcase++);
    }
  }
 } 

微信图片_20220927121821.png

注:

scanf("%lld %lld %lld",&a,&b,&c);
相关文章
PAT (Basic Level) Practice (中文) 1016 部分A+B (15 分)
PAT (Basic Level) Practice (中文) 1016 部分A+B (15 分)
64 0
|
C语言
PAT (Basic Level) Practice (中文) B1026 程序运行时间 (15 分)
PAT (Basic Level) Practice (中文) B1026 程序运行时间 (15 分)
96 0
PAT (Basic Level) Practice (中文) B1046 划拳 (15 分)
PAT (Basic Level) Practice (中文) B1046 划拳 (15 分)
59 0
|
存储 测试技术
PAT (Basic Level) Practice (中文) 1004 成绩排名 (20 分)
PAT (Basic Level) Practice (中文) 1004 成绩排名 (20 分)
64 0
|
算法
PAT (Basic Level) Practice (中文)1028. 人口普查(20分)
PAT (Basic Level) Practice (中文)1028. 人口普查(20分)
76 0
PAT (Basic Level) Practice (中文) 1036 跟奥巴马一起编程 (15 分) p89
PAT (Basic Level) Practice (中文) 1036 跟奥巴马一起编程 (15 分) p89
126 0
|
机器学习/深度学习 测试技术 Python
PAT (Basic Level) Practice (中文)第1002题
PAT (Basic Level) Practice (中文)第1002题
88 0
PAT (Basic Level) Practice (中文)- 1060 爱丁顿数(25 分)
PAT (Basic Level) Practice (中文)- 1060 爱丁顿数(25 分)
78 0
PAT (Basic Level) Practice (中文)- 1050 螺旋矩阵(25 分)
PAT (Basic Level) Practice (中文)- 1050 螺旋矩阵(25 分)
79 0
|
存储 人工智能
PAT (Basic Level) Practice (中文)- 1030 完美数列(25 分)
PAT (Basic Level) Practice (中文)- 1030 完美数列(25 分)
71 0