Skip to content

Commit 62bdf70

Browse files
committed
added solution1
1 parent 3a122b1 commit 62bdf70

7 files changed

Lines changed: 24 additions & 0 deletions

File tree

.DS_Store

2 KB
Binary file not shown.

Problems/.DS_Store

6 KB
Binary file not shown.

Problems/Mathematics/.DS_Store

6 KB
Binary file not shown.
6 KB
Binary file not shown.
10 KB
Binary file not shown.
6 KB
Binary file not shown.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include<iostream>
2+
#include<cmath>
3+
#include<algorithm>
4+
using namespace std;
5+
int main(){
6+
int t; cin>>t;
7+
while(t--){
8+
long long a,b,c;
9+
cin>>a>>b>>c;
10+
long long diff=abs(a-b);
11+
long long cir=2*diff;
12+
if(a>cir||b>cir||c>cir){
13+
cout<<-1<<endl;
14+
}
15+
else if(c<=diff){
16+
cout<<c+diff<<endl;
17+
}
18+
else{
19+
cout<<c-diff<<endl;
20+
}
21+
22+
}
23+
return 0;
24+
}

0 commit comments

Comments
 (0)