ABC memorandum [ABC158 C --Tax Increase] (Python)

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

0\leq A\leq B\leq 100 $ A, B $ are integers

C - Tax Increase

solution

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

ABC memorandum [ABC158 C --Tax Increase] (Python)
ABC memorandum [ABC163 C --managementr] (Python)
ABC memorandum [ABC159 C --Maximum Volume] (Python)
ABC memorandum [ABC161 C --Replacing Integer] (Python)
ABC147 C --HonestOrUnkind2 [Python]
ABC memorandum [ABC160 C --Traveling Salesman around Lake] (Python)
ABC163 C problem with python3
ABC188 C problem with python3
ABC187 C problem with python
Solve ABC163 A ~ C with Python
Python memorandum
ABC127 A, B, C Explanation (python)
Python Memorandum 2
ABC166 in Python A ~ C problem
Solve ABC168 A ~ C with Python
Python memorandum
Solve ABC036 A ~ C in Python
python memorandum
python memorandum
Solved AtCoder ABC 114 C-755 with Python3
Solve ABC162 A ~ C with Python
Solve ABC167 A ~ C with Python
ABC128 A, B, C commentary (python)
Solve ABC158 A ~ C with Python
ABC126 A, B, C Explanation (python)
Solve ABC037 A ~ C in Python
Python memorandum
python memorandum
Python memorandum
Solve ABC175 A, B, C in Python
Beginner ABC154 (Python)
Python basics memorandum
Python pathlib memorandum
AtCoder ABC 174 Python
Beginner ABC155 (Python)
python C ++ notes
python, openFrameworks (c ++)
Beginner ABC157 (Python)
Python memorandum [links]
AtCoder ABC 175 Python
Challenge AtCoder (ABC) 164 with Python! A ~ C problem
Python memorandum numbering variables
Python C / C ++ Extension Pattern-Pointer
python memorandum (sequential update)
Python memorandum (personal bookmark)
Next Python in C
Python basic memorandum part 2
Solve ABC169 in Python
Solve Atcoder ABC176 (A, B, C, E) in Python
C API in Python 3
[Python] Iterative processing_Personal memorandum
Memorandum @ Python OR Seminar
python memorandum super basic
[AtCoder explanation] Control ABC180 A, B, C problems with Python!
[AtCoder explanation] Control ABC188 A, B, C problems with Python!
[AtCoder explanation] Control ABC158 A, B, C problems with Python!
AtCoder ABC151 Problem D Speed comparison in C ++ / Python / PyPy
[AtCoder explanation] Control ABC164 A, B, C problems with Python!
[AtCoder explanation] Control ABC168 A, B, C problems with Python!
Extend python in C ++ (Boost.NumPy)
AtCoder ABC 177 Python (A ~ E)