【PAT甲级】1065 A+B and C (64bit) (20 分)(大数溢出)
2024-10-08 12:06:25
题意:
输入三个整数A,B,C(long long范围内),输出是否A+B>C。
trick:
测试点2包括溢出的数据,判断一下是否溢出即可。
AAAAAccepted code:
#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin>>t;
for(int i=;i<=t;++i){
if(i!=)
cout<<"\n";
long long a,b,c;
cin>>a>>b>>c;
long long x=a+b;
if(a>&&b>&&x<){
cout<<"Case #"<<i<<": true";
continue;
}
else if(a<&&b<&&x>=){
cout<<"Case #"<<i<<": false";
continue;
}
long long d=a+b;
if(d>c)
cout<<"Case #"<<i<<": true";
else
cout<<"Case #"<<i<<": false";
}
return ;
}
最新文章
- Class.forName的使用
- VS2008切换设计视图卡死 停止响应
- 转载:jsp中jstl标签的类似 if - else 语句 的语法
- db2 Hidden columns
- atitit.js 各版本 and 新特性跟浏览器支持报告
- Effective STL 中文版(大全)
- Python单元测试——深入理解unittest (转)
- 李洪强iOS开发之XMPP
- 腾讯企业邮箱又一次隐藏了qq邮件列表的入口
- C#学习笔记 day_two
- Python PIL
- 纯粹的python绑定
- HDU 1284(钱币兑换 背包/母函数)
- Anaconda安装python(idea兼容)
- Learning WCF:A Simple Demo
- ug nx7.5安装方法(图文详解)
- java并发之如何解决线程安全问题
- sqlserver 2008评估期已过
- 如何使用 python3 将RGB 图片转换为 灰度图
- RHCE 共享文件系统