F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

A+B Problem

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 726    Accepted Submission(s): 527


Problem Description
HZ has a special calculator, in which all the integers are 11-bit signed integers. The range of an 11-bit signed integer is from $-2^{10}$ to $2^{10}-1$ (from $-1024$ to $1023$). When using this calculator to calculate the sum of two integers $A$ and $B$, the result may be different from other calculators. Here are some examples:

$$
\begin{align*}
1 + 1 & = 2\\
1023 + 1 & = -1024\\
1023 + 2 & = -1023\\
-1024 + (-1) & = 1023\\
-1024 + (-2) & = 1022
\end{align*}
$$

HZ found this special calculator very strange, so he comes to you. You are given two integers $A$ and $B$, and you need to guess the result of $A+B$ of this calculator.
 

Input
The first line of input contains an integer $T$ ($1\leq T \leq 10^5$), denoting the number of test cases.

Each test case contains two integers $A$ and $B$ in one line. $-1024\leq A,B \leq 1023$.
 

Output
For each test case, print one integer in one line, denoting your answer.
 

Sample Input
5 1 1 1023 1 1023 2 -1024 -1 -1024 -2
 

Sample Output
2 -1024 -1023 1023 1022
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-06-26 23:16:20, Gzip enabled