Skip to content

Commit 0e96076

Browse files
authored
Merge pull request #141 from adrsh2808-creator/patch-1
2 parents dff2e28 + 1f18e6b commit 0e96076

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)