当前位置:网站首页>Pat 1065 a+b and C (64bit) (20 points) (16 points)
Pat 1065 a+b and C (64bit) (20 points) (16 points)
2022-07-01 14:26:00 【Python ml】
because A、B Of ⼤⼩ by [-2^63, 2^63],⽤long long Storage A and B Value , And the value they add sum:
If A > 0, B < 0 perhaps A < 0, B > 0,sum It is impossible to overflow
If A > 0, B > 0,sum It might spill over ,sum The scope should be (0, 2^64 – 2], The result of overflow should be [-2^63, -2]
It's a negative number , therefore sum < 0 It means overflow
If A < 0, B < 0,sum It might spill over , Empathy ,sum The result of overflow is ⼤ On 0 Of , therefore sum > 0 It means that it overflows
#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
for(int i=0;i<n;i++){
long long a,b,c;
cin>>a>>b>>c;
long long sum=a+b;
if(a>0&&b>0&&sum<0){
printf("Case #%d: true\n", i + 1);
} else if(a < 0 && b < 0 && sum >= 0){
printf("Case #%d: false\n", i + 1);
} else if(sum > c) {
printf("Case #%d: true\n", i + 1);
} else {
printf("Case #%d: false\n", i + 1);
}
}
return 0;
}
边栏推荐
- 算网融合赋能行业转型,移动云点亮数智未来新路标
- sqlilabs less10
- 微服务开发步骤(nacos)
- Distributed dynamic (collaborative) rendering / function runtime based on computing power driven, data and function collaboration
- sqlilabs less-8
- Research Report on the development trend and competitive strategy of the global display filter industry
- 逻辑是个好东西
- Research Report on the development trend and competitive strategy of the global traditional computer industry
- How can we protect our passwords?
- One of the data Lake series | you must love to read the history of minimalist data platforms, from data warehouse, data lake to Lake warehouse
猜你喜欢

Details of appium key knowledge

Opencv interpolation mode

微服务开发步骤(nacos)

Use of Oracle database objects

逻辑是个好东西

Error:Kotlin: Module was compiled with an incompatible version of Kotlin. The binary version of its

【商业终端仿真解决方案】上海道宁为您带来Georgia介绍、试用、教程

问题随记 —— Oracle 11g 卸载

Introduction to distributed transactions (Seata)

TDengine 连接器上线 Google Data Studio 应用商店
随机推荐
Realize queue with stack and stack with queue (C language \leetcode\u 232+225)
Advanced C language
佩服,阿里女程序卧底 500 多个黑产群……
SWT / anr problem - how to capture performance trace
Basic knowledge of C language
The integration of computing and Internet enables the transformation of the industry, and the mobile cloud lights up a new roadmap for the future of digital intelligence
Is it reasonable and safe for securities companies to open accounts for 10000 free securities? How to say
Opencv mat class
Fiori applications are shared through the enhancement of adaptation project
博文推荐 | 深入研究 Pulsar 中的消息分块
Research Report on the development trend and competitive strategy of the global pipeline robot inspection camera industry
Go整合Logrus实现日志打印
Vnctf2022 open web gocalc0
Research Report on development trend and competitive strategy of global vibration polishing machine industry
El form item regular verification
8 best practices to protect your IAC security!
Research Report on the development trend and competitive strategy of the global CCTV robot industry
用对场景,事半功倍!TDengine 的窗口查询功能及使用场景全介绍
30 Devops interview questions and answers
我们该如何保护自己的密码?