-
Notifications
You must be signed in to change notification settings - Fork 0
/
podium finish solution (october long 2022 division 4)
58 lines (46 loc) · 1.97 KB
/
podium finish solution (october long 2022 division 4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Problem
Chef got his dream seat in F1 and secured a 3^{rd}3
rd
place in his debut race. He now wants to know the time gap between him and the winner of the race.
You are his chief engineer and you only know the time gap between Chef and the runner up of the race, given as AA seconds, and the time gap between the runner up and the winner of the race, given as BB seconds.
Please calculate and inform Chef about the time gap between him and the winner of the race.
Input Format
The first line of input will contain a single integer TT, denoting the number of test cases.
Each test case consists of a single line of input containing two space-separated integers AA and BB denoting the time gap between Chef and the runner up and the time gap between the runner up and the winner respectively.
Output Format
For each test case, output the time gap between Chef and the winner of the race.
Constraints
1 \leq T \leq 1001≤T≤100
1 \leq A, B \leq 101≤A,B≤10
Sample 1:
Input
Output
4
1 1
2 5
3 2
5 6
2
7
5
11
Explanation:
Test case 11: The time gap between Chef and runner up is 11 second. The time gap between runner up and the winner is 11 second. Thus, the time gap between Chef and the winner is 1+1=21+1=2 seconds.
Test case 22: The time gap between Chef and runner up is 22 seconds. The time gap between runner up and the winner is 55 second. Thus, the time gap between Chef and the winner is 2+5=72+5=7 seconds.
Test case 33: The time gap between Chef and runner up is 33 seconds. The time gap between runner up and the winner is 22 second. Thus, the time gap between Chef and the winner is 3+2=53+2=5 seconds.
Test case 44: The time gap between Chef and runner up is 55 seconds. The time gap between runner up and the winner is 66 second. Thus, the time gap between Chef and the winner is 5+6=115+6=11 seconds.
answer:
#include <iostream>
using namespace std;
int main() {
int T;
cin>>T;
while(T--)
{
int A,B;
cin>>A>>B;
int gap = A+B;
cout<<gap<<endl;
}
return 0;
}