The solution to Very Noob Farmer seems very simple, however I ran into this issue:
After taking input,
unit_area = l2_area//l2
total_price = price*(l1 + l2)*unit_area
print(total_price)
gives me Wrong Answer, but
total_price = price*(l1 + l2)*l2_area//l2
print(total_price)
gives me AC. Why is this so?
It is not necessary that l2 divides l2_area due to which your first code may fail.
1 Like
l2 area = 3
l2=2
l1=2
Price=1
Now,
eqn 1 :
Unit area= floor(3/2)=1
And total price=1*4*1=4
eqn 2 :
floor(1*4*3/2) = floor(12/2) = 6
2 Likes
I see now that the question specifically says that only the output (total_price) will be an integer.
So l2_area//l2
and even (l2_area*l1)//l2
might not be an integer, only when multiplied with the price will we be sure to get an integer.
Thanks guys.
1 Like