-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1973A.cpp
More file actions
45 lines (41 loc) · 1.04 KB
/
Copy path1973A.cpp
File metadata and controls
45 lines (41 loc) · 1.04 KB
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
// Created on 17-May-24
//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
int main() {
int t;
cin >> t;
while (t--) {
int a, b, c;
cin >> a >> b >> c;
int maxDraw = 0;
if ((a + b + c) % 2 != 0) cout << -1 << endl;
// else if(a+b+c==0) cout << 0 << endl;
else {
if (a + b > c) {
// int tempA=a, tempB = b, tempC = c,;
// while (tempB != a && tempC != a) {
// tempB--;
// tempC--;
// maxDraw++;
// }
// while(tempC!=c ){
//
// }
maxDraw += a;
maxDraw += c % a;
maxDraw += c % b;
cout << maxDraw << endl;
} else if (a + b == c) {
cout << c << endl;
} else if (a + b < c) {
maxDraw = a + b;
cout << maxDraw << endl;
}
}
}
return 0;
}