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
 #include<cstdio>
#include<iostream>
using namespace std;
int main(){
int T;
long long a, b, c, test;
scanf("%d", &T);
for(int i = ; i < T; i++){
scanf("%lld%lld%lld", &a, &b, &c);
test = a + b;
if(a > && b > && test < ){
printf("Case #%d: true\n", i + );
}else if(a < && b < && test >= ){
printf("Case #%d: false\n", i + );
}else{
if(test > c)
printf("Case #%d: true\n", i + );
else
printf("Case #%d: false\n", i + );
}
}
return ;
}

总结:1、首先输入的范围在[-2^63, 2^63], 则只能用long long 8个byte存储。当a与b过大时,会产生溢出,需要考虑正数+正数=负数及负数+负数=正数的情况。

   2、A + B的结果不能在条件语句中直接与C比较,必须先存储于long long变量中。

A1065. A+B and C (64bit)的更多相关文章

  1. A1065 A+B and C (64bit) (20)(20 分)

    A1065 A+B and C (64bit) (20)(20 分) Given three integers A, B and C in [-2^63^, 2^63^], you are suppo ...

  2. PAT A1065 A+B and C (64bit) (20 分)

    AC代码 #include <cstdio> int main() { #ifdef ONLINE_JUDGE #else freopen("1.txt", " ...

  3. PAT甲级——A1065 A+B and C (64bit)

    Given three integers A, B and C in [−], you are supposed to tell whether A+B>C. Input Specificati ...

  4. PAT/简单模拟习题集(二)

    B1018. 锤子剪刀布 (20) Discription: 大家应该都会玩"锤子剪刀布"的游戏:两人同时给出手势,胜负规则如图所示: 现给出两人的交锋记录,请统计双方的胜.平.负 ...

  5. PAT题目AC汇总(待补全)

    题目AC汇总 甲级AC PAT A1001 A+B Format (20 分) PAT A1002 A+B for Polynomials(25) PAT A1005 Spell It Right ( ...

  6. 1065 A+B and C (64bit) (20 分)

    1065 A+B and C (64bit) (20 分) Given three integers A, B and C in [−2^​63​​,2​^63​​], you are suppose ...

  7. Can't load IA 32-bit .dll on a AMD 64-bit platform错误的解决

    64位的系统,64位的myeclipse,64位的jdk,64位的tomcat,结果报错:Can't load IA 64-bit .dll on a AMD 32-bit platform,简直无语 ...

  8. Ubuntu 14.04 64bit 安装tensorflow(GPU版本)

    本博客主要用于在Ubuntu14.04 64bit 操作系统上搭建google开源的深度学习框架tensorflow. 0.安装CUDA和cuDNN 如果要安装GPU版本的tensorflow,就必须 ...

  9. Caffe学习笔记2--Ubuntu 14.04 64bit 安装Caffe(GPU版本)

    0.检查配置 1. VMWare上运行的Ubuntu,并不能支持真实的GPU(除了特定版本的VMWare和特定的GPU,要求条件严格,所以我在VMWare上搭建好了Caffe环境后,又重新在Windo ...

随机推荐

  1. java学习之—并归排序

    /** * 并归排序 * Create by Administrator * 2018/6/26 0026 * 下午 5:13 **/ public class DArray { private lo ...

  2. java学习之—递归实现变位字

    /** * 递归实现变位字 * Create by Administrator * 2018/6/20 0020 * 上午 10:23 **/ public class AnagramApp { st ...

  3. systemd取消对服务重启的限制

    默认情况下,一个服务在10秒内最多允许启动5次.当超过5次后,会报如下错误: Job for xx.service failed because start of the service was at ...

  4. vs code軟件操作

    https://www.imooc.com/article/39349 https://www.html.cn/archives/8144

  5. Vue之computed计算属性

    demo.html <!DOCTYPE html> <html lang="en" xmlns:v-bind="http://www.w3.org/19 ...

  6. 十一、ASP.NET Boilerplate

    一.ASP.NET Boilerplate 实体是 DDD(领域驱动设计)的核心概念之一.Eric Evans 是这样描述的“很多对象不是通过它们的属性定义的,而是通过一连串的连续性事件和标识定义的” ...

  7. debug错误

    Description "opt_design" can fail with error messages similar to the following: opt_design ...

  8. vuex2.0 基本使用(1) --- state

    Vuex 的核心是 store, 它是一个通过 Vuex.Store 构造函数生成的对象.为什么它会是核心呢?因为我们调用这个构造函数创建store 对象的时候,给它传递参数中包装了state, mu ...

  9. CentOS 部署.net core 2.0 项目

    上传项目到服务器 安装Nginx(反向代理服务器),配置文件 https://www.cnblogs.com/xiaonangua/p/9176137.html 安装supervisor https: ...

  10. BZOJ2463[中山市选2009]谁能赢呢?——博弈论

    题目描述 小明和小红经常玩一个博弈游戏.给定一个n×n的棋盘,一个石头被放在棋盘的左上角.他们轮流移动石头.每一回合,选手只能把石头向上,下,左,右四个方向移动一格,并且要求移动到的格子之前不能被访问 ...