Skip to content

Commit 0238500

Browse files
Merge pull request #123 from Humanshere/main
Solved Mathematics/Day-01/q001.md
2 parents 05bb5f5 + 8c91eee commit 0238500

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+
//https://codeforces.com/contest/1560/submission/355194892
2+
3+
#include <bits/stdc++.h>
4+
using namespace std;
5+
6+
void solve(){
7+
int a,b,c;
8+
cin>>a>>b>>c;
9+
int n=2*abs(a-b);
10+
11+
int opp=c+n/2;
12+
if(c>n||b>n||a>n){
13+
cout<<-1<<endl;
14+
return;
15+
}
16+
if(opp>n)opp=opp-n;
17+
18+
cout<<opp<<endl;
19+
}
20+
21+
int main(){
22+
int t;
23+
cin>>t;
24+
while(t--)solve();
25+
}

0 commit comments

Comments
 (0)