当前位置:网站首页>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;
}
边栏推荐
- Logic is a good thing
- What "hard core innovations" does Intel have in the first half of 2022? Just look at this picture!
- 被裁三個月,面試到處碰壁,心態已經開始崩了
- 2022-2-15 learning the imitation Niuke project - post in Section 2
- phpcms实现订单直接支付宝支付功能
- Research Report on the development trend and competitive strategy of the global CCTV robot industry
- Research Report on the development trend and competitive strategy of the global powder filling machine industry
- SWT/ANR问题--当发送ANR/SWT时候如何打开binder trace(BinderTraces)
- Use the npoi package of net core 6 C to read excel Pictures in xlsx cells and stored to the specified server
- Research Report on the development trend and competitive strategy of the global commercial glassware industry
猜你喜欢
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
建立自己的网站(21)
Fiori applications are shared through the enhancement of adaptation project
Realize queue with stack and stack with queue (C language \leetcode\u 232+225)
Basis of target detection (NMS)
Play with grpc - communication between different programming languages
那个很努力的学生,高考失败了……别慌!你还有一次逆袭机会!
WebSocket(简单体验版)
Websocket (simple experience version)
Use the npoi package of net core 6 C to read excel Pictures in xlsx cells and stored to the specified server
随机推荐
sqlilabs less10
sqlilabs less10
Admire, Ali female program undercover more than 500 black production groups
El form item regular verification
Introduction to distributed transactions (Seata)
Fiori applications are shared through the enhancement of adaptation project
QT learning management system
Research Report on development trend and competitive strategy of global vibration polishing machine industry
643. Maximum average number of subarrays I
Six years of technology iteration, challenges and exploration of Alibaba's globalization and compliance
Distributed dynamic (collaborative) rendering / function runtime based on computing power driven, data and function collaboration
Provincial election + noi Part XI others
sqlilabs less9
微服务大行其道的今天,Service Mesh是怎样一种存在?
【R语言数据科学】:机器学习常见评估指标
sqlilabs less-11~12
Research Report on the development trend and competitive strategy of the global traditional computer industry
This paper introduces an implementation scheme to enhance the favorite transaction code management tool in SAP GUI
算网融合赋能行业转型,移动云点亮数智未来新路标
241. 为运算表达式设计优先级