We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 52bd1b3 + cce66f6 commit fc295c4Copy full SHA for fc295c4
1 file changed
Problems/Mathematics/Day-01/sol/Ishan Tripathi/Solution.cpp
@@ -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