Skip to content

Commit 8e69446

Browse files
authored
Merge pull request #156 from Rushalverma/main
2 parents a758280 + a210e7d commit 8e69446

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
3+
/*
4+
submission link: https://codeforces.com/contest/1560/submission/355218206
5+
Time complexity: O(1)
6+
*/
7+
8+
#include<bits/stdc++.h>
9+
using namespace std;
10+
11+
#define ll long long
12+
int main(){
13+
int t ; cin >> t;
14+
while(t--){
15+
ll a,b,c; cin >> a >> b >> c;
16+
ll n = abs(b-a)*2;
17+
if(a>n||b>n||c>n){
18+
cout << -1 << endl;
19+
}else{
20+
ll d = n/2 +c;
21+
if(d>n){ d -= n;}
22+
cout << d << endl;
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)