Skip to content

Commit fc295c4

Browse files
authored
Merge pull request #59 from ishantripathi64/main
added solution of the problem
2 parents 52bd1b3 + cce66f6 commit fc295c4

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
5+
int main()
6+
{
7+
int t;
8+
cin>>t;
9+
while(t--)
10+
{
11+
int a, b, c;
12+
cin>>a>>b>>c;
13+
int half=abs(b-a);
14+
int full=2*half;
15+
// cout<<full<<endl;
16+
if(a>full || b> full || c > full)
17+
{
18+
cout<<-1<<endl;
19+
}
20+
else
21+
{
22+
int ans=c+half;
23+
if(ans>full)
24+
{
25+
ans-=full;
26+
}
27+
cout<<ans<<endl;
28+
}
29+
30+
}
31+
32+
}

0 commit comments

Comments
 (0)