We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 449f17d commit 7b65791Copy full SHA for 7b65791
1311A - Add Odd or Subtract Even.cpp
@@ -0,0 +1,31 @@
1
+// ॐ नमः शिवाय
2
+#include<bits/stdc++.h>
3
+using namespace std;
4
+#define ll long long
5
+
6
+// Code Written By: Vikash Patel
7
+// Codeforces Profile: https://codeforces.com/profile/vikashpatel
8
9
+int solve(int a, int b)
10
+{
11
+ if(a==b)
12
+ return 0;
13
+ int op = 1;
14
+ if(a>b && (a-b)%2)
15
+ op++;
16
+ else if(b>a && (b-a)%2==0)
17
18
+ return op;
19
+}
20
+int main()
21
22
+ int t;
23
+ cin>>t;
24
+ while(t--)
25
+ {
26
+ int a,b;
27
+ cin>>a>>b;
28
+ cout<<solve(a,b)<<endl;
29
+ }
30
31
0 commit comments