Skip to content

Commit 0c2a7a2

Browse files
Merge pull request #160 from HarshitRSethi/harshit
Answered Problems/Mathematics/Day-01/q01.md as Harshit Sethi
2 parents f312f2b + ad2ca0c commit 0c2a7a2

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// https://codeforces.com/problemset/submission/1560/355220642
2+
3+
#include <iostream>
4+
#include <cmath>
5+
using namespace std;
6+
int main()
7+
{
8+
int t;
9+
cin >> t;
10+
while (t--)
11+
{
12+
long long a, b, c;
13+
cin >> a >> b >> c;
14+
long long order = fabs(a - b);
15+
if ((2 * order < a) || (2 * order < b) || (2 * order < c))
16+
cout << -1 << endl;
17+
else if (order < c)
18+
cout << c - order << endl;
19+
else
20+
cout << c + order << endl;
21+
}
22+
}

0 commit comments

Comments
 (0)