We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 922e95f + 3451a75 commit 45ad432Copy full SHA for 45ad432
1 file changed
Problems/Mathematics/Day-01/sol/Pritha/solution.cpp
@@ -0,0 +1,30 @@
1
+#include <bits/stdc++.h>
2
+using namespace std;
3
+
4
+int main(int argc, char const *argv[])
5
+{
6
+ int t;
7
+ cin >> t;
8
+ while (t--)
9
+ {
10
+ long long int a, b, c;
11
+ cin >> a >> b >> c;
12
+ if ((c <= abs(b - a) * 2) && (abs(b - a) >= min(a, b)))
13
14
+ if (c + abs(b - a) <= abs(b - a) * 2)
15
16
+ cout << c + abs(b - a) << endl;
17
+ }
18
+ else
19
20
+ cout << c - abs(b - a) << endl;
21
22
23
24
25
+ cout << -1 << endl;
26
27
28
29
+ return 0;
30
+}
0 commit comments