Problem statement
Please find the tax-excluded price of the product that is subject to the consumption tax of $ A $ yen when the consumption tax rate is $ 8 $% and $ B $ yen when the consumption tax rate is $ 10 $%. However, the tax-excluded price shall be a positive integer and shall be calculated by rounding down the decimal point in the calculation of consumption tax. If there are multiple prices excluding tax that meet the conditions, output the smallest amount. Also, if there is no tax-excluded price that meets the conditions, please output $ -1 $.
Constraints
Assuming that the price to be calculated is $ N $, $ N $ should be calculated so that $ 0.08N = A, 0.1N = B $ holds from the conditions. Therefore, the desired price is looped and brute force is tried. Since there is a condition of $ 0 \ leq A \ leq B \ leq 100 $, the number of loops is limited to $ 10000 $.
A, B = map(int,input().split())
for i in range(10000):
if int(i * 0.08) == A and int(i * 0.1) == B:
print(i)
exit()
print(-1)
Recommended Posts