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