有好多天没做AtCoder的题了,所以今天就练了一下,然后终于实现了一的突破,开始能做出第三题了,虽说只是Beginner,但是也算有点进步了,下面是具体过程:
**C - Tax Increase /**
Time Limit: 2 sec / Memory Limit: 1024 MB
Score : 300 points
Problem Statement
Find the price of a product before tax such that, when the consumption tax rate is 8
percent and 10 percent, the amount of consumption tax levied on it is A yen and B yen, respectively. (Yen is the currency of Japan.)
Here, the price before tax must be a positive integer, and the amount of consumption tax is rounded down to the nearest integer.
If multiple prices satisfy the condition, print the lowest such price; if no price satisfies the condition, print -1.
Constraints
1≤A≤B≤100
A and B are integers.
首先:我们先来理解这个题目:
就是要找一个数,假设它是x,那么0.08x的向下取整就是A,它的0.1x的向下取整就是B。
那么我们先来确定x的范围,A的12.5倍(即A/0.08