当前位置:网站首页>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;
}
边栏推荐
- About the use of HTTP cache validation last modified and Etag
- 问题随记 —— Oracle 11g 卸载
- Provincial election + noi Part XI others
- sqlilabs less13
- Advanced C language
- 30 Devops interview questions and answers
- Guess lantern riddles, not programmers still can't understand?
- 数据湖系列之一 | 你一定爱读的极简数据平台史,从数据仓库、数据湖到湖仓一体
- Vnctf2022 open web gocalc0
- 当主程架构游戏的时候,防止到处调用减少耦合性,怎么开放接口给其他人调用呢?
猜你喜欢

Websocket (simple experience version)

Basic operation of queue (implemented in C language)

Build your own website (21)

Six years of technology iteration, challenges and exploration of Alibaba's globalization and compliance

【牛客网刷题系列 之 Verilog快速入门】~ 使用函数实现数据大小端转换

算网融合赋能行业转型,移动云点亮数智未来新路标

Phpcms realizes the direct Alipay payment function of orders

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?

2022-2-15 learning xiangniuke project - Section 4 business management

【牛客网刷题系列 之 Verilog快速入门】~ 多功能数据处理器、求两个数的差值、使用generate…for语句简化代码、使用子模块实现三输入数的大小比较
随机推荐
Use of Oracle database objects
MySQL日志
Research Report on the development trend and competitive strategy of the global indexable milling cutter industry
数据湖系列之一 | 你一定爱读的极简数据平台史,从数据仓库、数据湖到湖仓一体
力扣解法汇总241-为运算表达式设计优先级
Après avoir été licencié pendant trois mois, l'entrevue s'est effondrée et l'état d'esprit a commencé à s'effondrer.
2022-2-15 learning xiangniuke project - Section 1 filtering sensitive words
2022-2-15 learning xiangniuke project - Section 4 business management
8 best practices to protect your IAC security!
我们该如何保护自己的密码?
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
sqlilabs less13
App automation testing Kaiyuan platform appium runner
TDengine 连接器上线 Google Data Studio 应用商店
[dynamic programming] p1004 grid access (four-dimensional DP template question)
Details of appium key knowledge
Research Report on the development trend and competitive strategy of the global aviation leasing service industry
sqlilabs less-8
队列的基本操作(C语言实现)
241. 为运算表达式设计优先级