Hangzhou Electric 2096

Source: Internet
Author: User

Xiao Ming A+b

Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 37194 Accepted Submission (s): 17644


Problem Description Ming is 3 years old, now he has been able to recognize 100 of non-negative integers, and be able to do a non-negative integer within 100 of the addition calculation.
for integers greater than or equal to 100, xiaoming only retains the last two digits of the number for calculation, and if the result is greater than or equal to 100, Xiaoming retains only the last two digits of the calculated result.

For example, for xiaoming:
1) 1234 and 34 are equal
2) 35+80=15

Given nonnegative integers A and B, your task is to calculate the value of A+b on behalf of Xiaoming.

The first behavior of input data is a positive integer t, which represents the number of groups of test data. Then the T-Group test data. Each set of test data consists of two nonnegative integers A and B (A and B are within the range represented by the int type).

Output for each set of test data, outputs the results of xiaoming a+b.

Sample Input235 8015 1152

Sample Output1567

Sourcehdu 2007-spring Programming Contest

#include <iostream>
using namespace Std;
int main ()
{
int n,a,b,c;
cin>>n;

while (n--)
{
cin>>a>>b;
if (a > 100)
{
A = a% 100;
}
if (b > 100)
{
b = b% 100;
}
c = a + B;
if (c >= 100)
cout<<c%100<<endl;
Else
cout<<c<<endl;
}
return 0;
}

Hangzhou Electric 2096

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.