1065. A+B and C (64bit)
来源:互联网 发布:小米网络音响 闹钟 编辑:程序博客网 时间:2024/06/05 17:49
检测int加法溢出用(a>0&&b>0&&b>INT_MAX-a) ||(a<0&&b<0&&b<INT_MIN-a)
long long范围是[-2^63, 2^63),但这里的范围是[-2^63, 2^63],如果对于a,b,c分别为2^63 ,0,2^63的情况,long long 根本就不能存这种数,所以用long long 来做这个题是不对的,必须自己做一个大整数的加减法或用java等的大整数功能,所以,我使用long double存的。。。
#include<iostream>using namespace std;char T[]="Case #%d: true\n";char F[]="Case #%d: false\n";int main(){ int n;cin>>n; for(int i=1;i<=n;++i){ long double a,b,c; cin>>a>>b>>c; printf(a+b>c?T:F,i); }}
0 0
- 1065. A+B and C (64bit)
- 1065. A+B and C (64bit)
- 1065. A+B and C (64bit)
- 1065.A+B and C (64bit)
- 1065. A+B and C (64bit)
- 1065. A+B and C (64bit)
- 1065. A+B and C (64bit)
- 1065. A+B and C (64bit)
- 1065. A+B and C (64bit)
- 1065. A+B and C (64bit)
- PAT A 1065. A+B and C (64bit) (20)
- PAt-A 1065. A+B and C(64bit)
- PAT-A 1065. A+B and C (64bit) (20)
- PAT-A-1065. A+B and C (64bit) (20)
- pat1065 A+B and C (64bit)
- PAT A+B and C (64bit)
- 1065 A+B and C(64bit)
- A+B and C (64bit) (20)
- Android KEYCODE键值对应大全
- Android对sdcard操作
- C++ 项目3 文件加结构体实现实用系统
- HDU-4500-小Q系列故事——屌丝的逆袭
- D. DZY Loves Modification
- 1065. A+B and C (64bit)
- [数论] POJ 3126 Prime Path
- sql 中分割字符串的方法
- [HDOJ 3708][Vjudge 41282] Warrior Lady [动态规划]
- 第八章 进程控制 fork函数
- HDU 1548 A strange lift (BFS或最短路)
- Android中Cocos2d-X引擎响应按键消息
- Hive配置项的含义详解
- LPC Communication