当前位置:网站首页>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;
}
边栏推荐
- Research Report on the development trend and competitive strategy of the global diamond suspension industry
- Phpcms realizes the direct Alipay payment function of orders
- Sorting learning sorting
- 户外LED显示屏应该考虑哪些问题?
- Research Report on the development trend and competitive strategy of the global electromagnetic flowmeter industry
- TDengine 连接器上线 Google Data Studio 应用商店
- 【商业终端仿真解决方案】上海道宁为您带来Georgia介绍、试用、教程
- Scheme of printing statistical information in log
- [R language data science]: common evaluation indicators of machine learning
- Research Report on development trend and competitive strategy of global consumer glassware industry
猜你喜欢

C 语言基础

博文推荐 | 深入研究 Pulsar 中的消息分块

奔涌而来的数字化浪潮,将怎样颠覆未来?

【R语言数据科学】:机器学习常见评估指标

问题随记 —— Oracle 11g 卸载

phpcms实现订单直接支付宝支付功能

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

Après avoir été licencié pendant trois mois, l'entrevue s'est effondrée et l'état d'esprit a commencé à s'effondrer.
![[dynamic programming] interval dp:p1005 matrix retrieval](/img/c9/2091f51b905d2c0ebc978dab3d34d3.jpg)
[dynamic programming] interval dp:p1005 matrix retrieval

Why did you win the first Taosi culture award of 20000 RMB if you are neither a top R & D expert nor a sales Daniel?
随机推荐
Research Report on development trend and competitive strategy of global 4-aminodiphenylamine industry
Basic operation of queue (implemented in C language)
sqlilabs less13
Effet halo - qui dit qu'il y a de la lumière sur la tête est un héros
How to pass array parameters in get request
[IOT completion. Part 2] stm32+ smart cloud aiot+ laboratory security monitoring system
Play with grpc - communication between different programming languages
逻辑是个好东西
sqlilabs less-11~12
Provincial election + noi Part VIII fraction theory
Opencv mat class
QT learning management system
Today, with the popularity of micro services, how does service mesh exist?
30 Devops interview questions and answers
That hard-working student failed the college entrance examination... Don't panic! You have another chance to counter attack!
Texstudio tutorial
Go integrates logrus to realize log printing
What problems should be considered for outdoor LED display?
About the use of HTTP cache validation last modified and Etag
Use the npoi package of net core 6 C to read excel Pictures in xlsx cells and stored to the specified server