# Error in one problem of june lunchtime 2021 code = REALBIN

In the June Lunch time challenge problem name Form Rational to binary problem code REALBIN.
I think there is some problem with editorial of this problem as according to problem statement, we have to say whether a number can become 0 or 1 on addition of several rational numbers, in short we have to check number is rational or not.
In this questions editorial if we give a = 1 and b = 5 it is giving No as answer which should not be the case as 1/5 is rational number 0.2 and subtracting 0.2 from it will give 0 so it is a correct input.
But all inputs consisting powers of 5 are neglected in this problem.
I am unable to find out why this is happening

if you give 1/5 then he can add it, so now it will become 2/5

so if 1/5 is added 4 times to 1/5 it becomes 1, that is for a finite value N (N = 4 here) X becomes equal to 1 hence answer should be âYesâ. Please explain

it depends on divyam to add or subtract

1 Like

@puneet18
Bro you choose a value and someone else(divyam) will choose which operation to perform . He donât want you to win .
Like in case of 1/5 you choose X=1/5 , oviously he will not choose to substract as the value will become â0â and you/chef will win , so he will add 1/5 âŚ now our initial value become 2/5 , if you will choose X = 1/5 again he will substract it from 2/5 resulting our intial vale to be 1/5 and this will run infinitely.

2 Likes

he donât want you to win , so he will add at this point .

2 Likes

divyam donât want to make it 0 or 1

1 Like

OhâŚgot it now thanks manâŚ

1 Like

If we take the example, X = 0.2. As you said, if we take Y = 0.8 and add it to X, then, we will get the answer to be 1. But, the problem statement states that Y can either be added to X, or subtracted from X. That choice lies with Divyam. So, Divyam would subtract in this case, so that, Chef does not win.

1 Like

The question does nât ask if itâs possible to reach 0 or 1 in finite steps.
Divyam can use the operations âaddâ or âsubtractâ in such a way that he can avoid 0 or 1.
For eg. - if x = 1/5 and Chef gives him 1/5, then he can add it to make x = 2/5
Suppose again x = 1/5 is given, then he can subtract 1/5 from x and then x becomes 1/5.
So, no matter how many times you give 1/5, Divyam can go from 1/5 to 2/5 and then return to 1/5 again.

1 Like

This problem was one of the most beautiful problem ,
i took 8 submission for the correct one ,
my first approach was to think mathematically ,
basically upto 4th try i was trying mathematical relation finding ,
then i realised ONLY 0.5 is the number who can normally jump to 1 or 0 ,
then i observed 0.25 and 0.75 can be brought to 0.5 with the given condition ,
and further realised B just have to be power of 2

1 Like

but if we choose 1/3 then also chef will win , so How come people are using odd even logic here???

chef will not win in this case buddy . You will not be able to make 1/3 to 1 or 0

ok I will once again go through the question
Currently , I am not able to understand

actually b should have only one factor which is 2 and donât say problem have error coz u didnât understood and yes donât cheat in contest i know you cheated in tic tac toe of june lunchtime