A + B Is Overflow
来源:互联网 发布:查询mysql数据库ip 编辑:程序博客网 时间:2024/05/21 14:58
Description
Judge whether the sum of A and B will exceed the range of 32-bit signed integer.
InputThere are multiple test cases.
The first line of each test case is a positive integer T, indicating the number of test cases.
For each test case, there is only one line including two 32-bit signed integers A and B.
OutputFor each test case, output one line.
If the sum of A and B will exceed the range of integer, print "Yes", else print "No".
Sample Input31 2-2147483648 21474836472147483647 2147483647
Sample OutputNoNoYes
#include<stdio.h>
int main()
{
int t,a,b;
while(~scanf("%d",&t))
{
while(t--)
{
scanf("%d%d",&a,&b);
if(a>0&b>0&&a+b<=0||a<0&&b<0&&a+b>=0)
{
printf("Yes\n");
}
else{
printf("No\n");
}
}
}
return 0;
}
0 0
- A + B Is Overflow
- 如何解决 a+b >c 和 a*b 和 a-b 的 integer overflow 问题
- Why is “a^=b^=a^=b;” different from “a^=b; b^=a; a^=b;”?
- This is an A+B Problem
- Your task is to Calculate a + b.
- python中==和is的区别,a==b和a is b
- Debugging a Stack Overflow
- overflow - a secret benifit
- python 对象池 a=1 b=1 a is b True a=257 b= 257 a is b False
- b[d.xtype || e] is not a constructor
- Inheritance: 'A' is an inaccessible base of 'B'
- b[d.xtype || e] is not a constructor
- ACdream 群赛1221 Problem B: cxlove is a good man
- This is an A+B Problem SDUT 2613
- 简单题:Your task is to Calculate a + b.
- Uncaught TypeError: b.nodeName.toLowerCase is not a function
- Exploiting a MIPS Stack Overflow
- a>b?a:b
- android解析加载图片的3种方式
- Maven 依赖 spring-web 对战 spring-webmvc
- 51nod 1073 约瑟夫环 (数学)
- ionic 集成极光推送和增加本地插件
- 什么是权限管理
- A + B Is Overflow
- git 时遇到fatal:multiple stage entries for merged file处理办法
- CSS选择符优先级
- 仅需三步,让您的员工绩效都得A!
- typecheck(type,x) 作用
- 和喜欢的女生聊天 15 分钟以后就找不到话题了怎么办?
- Java中的异常处理
- 51nod 1008 N的阶乘 mod P
- 将IplImage转换为Mat