We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 12f6911 + c39ad8e commit ab228eaCopy full SHA for ab228ea
1 file changed
Problems/Mathematics/Day-01/sol/Arnav_Singh/Solution1.cpp
@@ -0,0 +1,26 @@
1
+//adding submission link as suggested earlier
2
+//https://codeforces.com/problemset/submission/1560/355167404
3
+
4
+#include <bits/stdc++.h>
5
+using namespace std;
6
7
+int main() {
8
+ int t;
9
+ cin >> t;
10
+ while(t--) {
11
+ int a,b,c;
12
+ cin>>a>>b>>c;
13
+ if((abs(b-a))*2<max(a,max(b,c))){
14
+ cout << -1 <<'\n';
15
+ continue;
16
+ }
17
+ if(c+(abs(b-a))>(abs(b-a)*2)){
18
+ cout<<(c+(abs(b-a)))%(abs(b-a)*2)<<'\n';
19
20
+ else{
21
+ cout<<c+(abs(b-a))<<'\n';
22
23
24
25
+ return 0;
26
+}
0 commit comments