11247 - Income Tax
Solution Description : Ad hoc math problem Suppose Ans is A Input M and x 100 BDT pay Tax= x 1 BDT pay Tax= x/100 A BDT pay Tax= x*A/100 From problem description you can got M-1 = A - x*A/100 => M-1 = (100*A - x*A)/100 => (M-1)*100 = 100*A - x*A => (M-1)*100 = A*(100-x) So, A = (M-1)*100/(100-x) You got ans using this equation But when x=100 then you got divide by zero error this time ans is "Not Found" the ans must be less than (M-1)*100/(100-x) i.e if M=20 and x=10 then A = 21.111111111 so the ans is 21 if M=20 and x=99 then A = 1900 so then ans is 1899 Remember another thing if ans is less than or equal M then print "Not Found" use data type long long |
||||||||||