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
思路
  • a,b,c的范围就知道就算使用long long也是要溢出的,这里我尝试取巧地使用了long doubledouble在我的codeblock上是8字节,而long double是12字节,不知道OJ上的是怎么样的,试着用一下还过了…
代码
#include<bits/stdc++.h>
using namespace std; int main()
{
int n;
long double a,b,c;
cin >> n;
for(int i=1;i<=n;i++)
{
cin >> a >> b >> c;
if(a + b > c)
cout << "Case #" << i <<": true" << endl;
else
cout << "Case #" << i <<": false" << endl;
}
return 0;
}
引用

https://pintia.cn/problem-sets/994805342720868352/problems/994805406352654336

PTA(Advanced Level)1065.A+B and C的更多相关文章

  1. PTA(Advanced Level)1036.Boys vs Girls

    This time you are asked to tell the difference between the lowest grade of all the male students and ...

  2. PTA (Advanced Level) 1004 Counting Leaves

    Counting Leaves A family hierarchy is usually presented by a pedigree tree. Your job is to count tho ...

  3. PTA (Advanced Level) 1020 Tree Traversals

    Tree Traversals Suppose that all the keys in a binary tree are distinct positive integers. Given the ...

  4. PTA(Advanced Level)1025.PAT Ranking

    To evaluate the performance of our first year CS majored students, we consider their grades of three ...

  5. PAT (Advanced Level) 1065. A+B and C (64bit) (20)

    因为会溢出,因此判断条件需要转化.变成b>c-a #include<cstdio> #include<cstring> #include<cmath> #in ...

  6. PTA (Advanced Level) 1009 Product of Polynomials

    1009 Product of Polynomials This time, you are supposed to find A×B where A and B are two polynomial ...

  7. PTA (Advanced Level) 1008 Elevator

    Elevator The highest building in our city has only one elevator. A request list is made up with Npos ...

  8. PTA (Advanced Level) 1007 Maximum Subsequence Sum

    Maximum Subsequence Sum Given a sequence of K integers { N​1​​, N​2​​, ..., N​K​​ }. A continuous su ...

  9. PTA (Advanced Level) 1006 Sign In and Sign Out

    Sign In and Sign Out At the beginning of every day, the first person who signs in the computer room ...

随机推荐

  1. cookbook 11.1 在文本控制台中显示进度条

    任务: 在进行长时间操作时,向用户显示一个"进度指示条". 解决方案: #coding=utf-8 import sys class progressbar(object): de ...

  2. 51 Nod 1035 最长的循环节 (此题还不是很懂,日后再看)

    转自: https://blog.csdn.net/define_danmu_primer/article/details/52456763 51nod 1035 最长的循环节(无限小数的循环节) 2 ...

  3. 博弈dp入门 POJ - 1678 HDU - 4597

    本来博弈还没怎么搞懂,又和dp搞上了,哇,这真是冰火两重天,爽哉妙哉. 我自己的理解就是,博弈dp有点像对抗搜索的意思,但并不是对抗搜索,因为它是像博弈一样,大多数以当前的操作者来dp,光想是想不通的 ...

  4. Node.js安装及环境配置

     1.Node.js简介 简单的说 Node.js 就是运行在服务端的 JavaScript. Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境. Node.js ...

  5. [Deep Learning] GELU (Gaussian Error Linerar Units)

    (转载请注明出处哦~) 参考链接: 1. 误差函数的wiki百科:https://zh.wikipedia.org/wiki/%E8%AF%AF%E5%B7%AE%E5%87%BD%E6%95%B0 ...

  6. JavaWeb_(Struts2框架)Action中struts-default下result的各种转发类型

    此系列博文基于同一个项目已上传至github 传送门 JavaWeb_(Struts2框架)Struts创建Action的三种方式 传送门 JavaWeb_(Struts2框架)struts.xml核 ...

  7. [CSP-S模拟测试]:二叉搜索树(DP+贪心)

    题目传送门(内部题99) 输入格式 第一行一个整数$n$,第二行$n$个整数$x_1\sim x_n$. 输出格式 一行一个整数表示答案. 样例 样例输入: 58 2 1 4 3 样例输出: 数据范围 ...

  8. $\LaTeX$数学公式大全11

    $11\ Other\ Styles\ (math\ mode\ only)$ $Caligraphic\ letters:$ \mathcal{A}$etc.:\mathcal{ABCDEFGHIJ ...

  9. go面试题

    1)解释什么是GO? GO是一种开源编程语言,可以轻松构建简单.可靠和高效的软件.程序是从包中构建的,其属性允许有效地管理依赖关系. 2)GO中的语法是什么? GO中的语法遵循Extended Bac ...

  10. 2018-2019-2 20175215 实验三《敏捷开发与XP实践》实验报告

    一.实验内容与步骤 1.安装.使用alibaba 插件规范代码 在IDEA的setting中找到plugins并搜索alibaba,点击install进行安装 重启IDEA后,在代码中右击点击编码规约 ...