We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a5c5031 + 7618447 commit 8d5315cCopy full SHA for 8d5315c
1 file changed
Problems/Mathematics/Day-01/sol/Aiyaan_Mahajan/Q1sol.cpp
@@ -0,0 +1,32 @@
1
+/*
2
+DAY 1
3
+Q1 Who's Opposite?
4
+.*/
5
+
6
+typedef long long ll;
7
+#include <bits/stdc++.h>
8
+using namespace std;
9
10
+int main() {
11
+ int t;
12
+ cin>>t;
13
+ while(t--){
14
+ ll a, b, c;
15
+ cin >> a >> b >> c;
16
17
+ ll diff = abs(a - b);
18
+ ll n = 2 * diff;
19
20
+ if (diff==0 || max({a,b,c})> n){
21
+ cout << -1 << endl;
22
+ } else {
23
+ ll d = c + diff;
24
+ if (d > n) d -= n;
25
+ cout << d << endl;
26
+ }
27
28
+ return 0;
29
+}
30
31
+My submission : https://codeforces.com/contest/1560/submission/355307599
32
+*/
0 commit comments