Skip to content

Commit 86812f8

Browse files
authored
Merge pull request #262 from Taskmaster-afk/main
Solution for Q1 Day1
2 parents 72c2039 + 2ca61a7 commit 86812f8

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

  • Problems/Mathematics/Day-01/sol/Kushagra Raghuvanshi
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// https://codeforces.com/problemset/submission/1560/355220642
2+
3+
#include <bits/stdc++.h>
4+
using namespace std;
5+
int main(){
6+
int t;
7+
cin>>t;
8+
while(t--){
9+
int a,b,c;
10+
cin>>a>>b>>c;
11+
int n=2*abs(a-b);
12+
if(a>n||b>n||c>n){
13+
cout<<-1<<endl;
14+
continue;
15+
}
16+
int s=c+n/2;
17+
if(s>n) s-=n;
18+
cout<<s<<endl;
19+
}
20+
}

0 commit comments

Comments
 (0)