EOOPR - Editorial

a and b are constants hence we can’t change them.

ok. thanks a lot

1 Like

py_compile.PyCompileError: Sorry: TabError: inconsistent use of tabs and spaces in indentation (prog.py, line 6)
i am getting this error again and again with you code in Python.
help me out

I have corrected it.

hey brother
sorry to interrupt
if i have to go from 2 to 10
the difference is 8
i can do it in 2+ 7+1 = 10
making it only 2 steps
adding odd 7 and adding odd 1

1 Like

Hey Brother,
You cannot change a and b.
Either you can do 2+7+7 (if a = 7) or you can do 2+1+1 (if a = 1 )
You can refer this explanation - Click Here

Why is it wrong??

https://www.codechef.com/viewsolution/39569192

#include
using namespace std;

int main() {
long long t;
cin>>t;
while(t){
long long x,y,pd;
cin>>x>>y;
if(x==y){
std::cout << “1” << std::endl;
}
else if(y>x){
pd=y-x;
if(pd%2==0){
if((pd/2)%2==0){
cout<<“3”;
}
else if((pd/2)%2!=0){
cout<<“2”;
}
}
else
std::cout << “1” << std::endl;
}
else if(y<x){
pd=y-x;
if(pd%2==0){
cout<<“1”;
}
else
std::cout << “2” << std::endl;
}

    t--;
}
return 0;

}

What is wrong in this code ?

am javaScript developer. jest today opened CodeChef . How to Start it. and Where to find solutions in JS code. plz help me.

1 Like

Hi, anyone please tell me why did we use the difference between the X and Y. Because I am not to get this question like this my first question here.

1 Like

bro i am geting EOF error, even though i am using the editorial code. how to correct it

why i am getting EOF error with this solution, even i used the same code.

You can visit the problem and go to “all submissions” , then select you language and search.

let me check the solution.Send your solution link.

You can refer this explaination - Click Here

for _ in range(int(input())):
x,y = input().split()
X = int(x)
Y = int(y)
dif = Y-X
rounds = 0
if dif>0 and dif%2==0:
if dif%4 != 0:
rounds =3
else:
rounds = 2
elif dif>0 and dif%2 != 0:
rounds = 1
elif dif<0 and dif%2 == 0:
rounds = 1
elif dif<0 and dif%2 != 0:
rounds = 2
else:
rounds = 0
print(rounds)
this code of mine works fine but after submitting it says that it is wrong ans.
please tell me any thing wrong with my code

@star_in if diff%4!=0 then rounds will be 2 because then we can find an odd number resulting in that difference else rounds will be 3.

Can anybody please explain this line…
#define zapp ios::sync_with_stdio(false);cin.tie(0)

since you can’t change the values of the ‘a’ and ‘b’, lets say, to make dif = 4 you have to take a = 3 and b =2
then a+a-b = 4 it means that we have to add the value of ‘a’ two time in X and value of ‘b’ one time.
So now the rounds will be 3, not 2.

In ps there is a term " in order to clean" so how can even x>y,
that means if x=4 and y=0 , so you are making things dirty to achieve the level of y