HDU-2096 XiaoMing A+B

See the article on https://dyingdown.github.io/2019/12/19/HDU-2096%20XiaoMing%20A+B/

XiaoMing A+B

Xiaoming is 3 years old, and now he can recognize non-negative integers up to 100, and can add non-negative integers up to 100.
For integers greater than or equal to 100, Xiaoming retains only the last two digits of the number for calculation.If the calculation result is greater than or equal to 100, then Xiaoming also retains only the last two digits of the calculation result.

For example, for Xiao Ming:

  1. 1234 and 34 are equal
  2. 35 + 80 = 15

Given the non-negative integers A and B, your task is to calculate the value of A + B on behalf of Xiao Ming.

Input

The first line of the input data is a positive integer T, which represents the number of test data groups. Then there are T groups of test data. Each group of test data contains two non-negative integers A and B (A and B are in the range represented by int type) Inside).

Output

For each set of test data, output the result of Xiaoming A + B.

Sample Input
2
35 80
15 1152
Sample Output
15
67

Analysis

a and b each mod 100 and the answer a + b mod 100

code

#include<bits/stdc++.h>

using namespace std;

int main() {
	int t;
	cin >> t;
	while(t --) {
		int a, b;
		cin >> a >> b;
		a %= 100; b %= 100;
		cout << (a + b) % 100 << endl;
	}
	return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值