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

时间限制
100 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
HOU, Qiming

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 思路
注意溢出的情况就行,其他情况正常比较,溢出分两种情况:
1. A > 0,B > 0, Sum = A + B 正溢出,溢出后的值Sum <= 0;
2. A < 0,B < 0, Sum = A + B 负溢出,溢出后的值Sum >= 0; 代码
#include<iostream>
#include<vector>
using namespace std;
int main()
{
int T;
while(cin >> T)
{
long long a,b,c;
for(int i = ; i <= T; i++)
{
cin >> a >> b >> c;
long long sum = a + b; if(a < && b < && sum >= ) //最小负数相加溢出
cout << "Case #" << i <<": false" << endl;
else if(a > && b > && sum <= ) //最大正数相加溢出
cout << "Case #" << i <<": true" << endl;
else if(sum > c)
cout << "Case #" << i <<": true" << endl;
else
cout << "Case #" << i <<": false" << endl;
}
}
return ;
}

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

  1. 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,简直无语 ...

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

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

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

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

  4. Window7下安装Ubuntu 14.04 64bit

    本文章主要讲解如何在Windows7操作系统中硬盘安装Ubuntu 14.04 64bit: 1.准备文件 1.ubuntu-14.04.4-desktop-amd64.iso 2.EasyBCD.e ...

  5. Caffe学习笔记1--Ubuntu 14.04 64bit caffe安装

    本篇博客主要用于记录Ubuntu 14.04 64bit操作系统搭建caffe环境,目前针对的的是CPU版本: 1.安装依赖库 sudo apt-get install libprotobuf-dev ...

  6. 如何完全卸载OneDrive (Windows 10 64bit)

    原文参考 http://lifehacker.com/how-to-completely-uninstall-onedrive-in-windows-10-1725363532 To complete ...

  7. RHEL6 64位系统安装ORACLE 10g 64bit 数据库

    记得去年4月份的时候,为公司部署测试环境和UAT环境时,在红帽RHEL6 64位系统安装ORACLE 10g 64位数据库时遇到了许多小问题,当时匆匆忙忙也没记录一下这些问题,前几天在虚拟机安装ORA ...

  8. Win7 下安装VirtualBox 没有Ubuntu 64bit 选项问题

    参考: win7安装virtualbox遇到的问题 基于VirtualBox虚拟机安装Ubuntu图文教程 问题 在安装VirtualBox之后,选择虚拟机进行安装的时候发现没有Ubuntu 64bi ...

  9. 关于Linux x64 Oracle JDK7u60 64-bit HotSpot VM 线程栈默认大小问题的整理

    JVM线程的栈默认大小,oracle官网有简单描述: In Java SE 6, the default on Sparc is 512k in the 32-bit VM, and 1024k in ...

随机推荐

  1. Eclipse搭建Android环境失败的解决方案

    今天在Eclipse上搭建Android开发环境,不仅在安装ADT的过程中老是出错,而且Android SDK下载后,打开SDK Manager时也无法链接到网页下载tools,网上查了好多方法,试了 ...

  2. Java-transient总结

    纸上得来终觉浅,绝知此事要躬行  --陆游    问渠那得清如许,为有源头活水来  --朱熹 transient有"临时的","短暂的"含义,我们了解过Seri ...

  3. Debian系列软件管理(第二版)

    Debian系列软件管理 1.搜索软件包信息 apt-cache search apt-cache search yum 2.查看软件包信息 apt-cache show rpm 3.安装软件 apt ...

  4. linux内核 container_ofC语言之应用

    之前在剖析内核链表的文章中就有说到这个 container_of宏展开后的应用技巧. //offset(struct list , list);----->展开后((size_t) & ...

  5. 一键安装 redmine on rhel6.4

    一键安装 redmine on rhel6.4 一键式安装redmine省去了大量不必要的时间.下载:bitnami-redmine-2.5.2-1-linux-x64-installer.run. ...

  6. 【ROM修改教程】添加高级电源重启菜单(安卓4.0.4官方ROM)

    准备工作: 电脑上安装好JDK.下载smali和baksmali.下载apktools.要修改的ROM.adb工具(可选) 注:由于本教程面向的对象为有一定ROM修改基础的兄弟,所以对于如何使用电脑, ...

  7. objective-c中线程编程一例

    /* print with threads : print every file's first n char contents under the path that pass to this pr ...

  8. MurmurHash

    public int hash(byte[] data, int length, int seed) {     int m = 0x5bd1e995;     int r = 24;     int ...

  9. Effective STL 为包含指针的关联容器指定比较类型

    // 为包含指针的关联容器指定比较类型.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <set> #incl ...

  10. 在GitHub上创建代码仓库

    目前在GitHub上管理托管带代码的人越来越多了,今天也尝试了一次,顺便记下来,备用. 首先是在GitHub上创建一个代码仓库,创建完之后,GitHub上会有提示,这时进入项目目录执行下面的命令,顺便 ...