308463: CF1525A. Potion-making
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Potion-making
题意翻译
你需要配置一份溶液,已知溶质的质量分数为 $k\%$,每次你可以添加 $1$ 单位的溶质或者溶剂,请问最少需要添加多少次才能使得溶质的质量分数为 $k\%$? translated by @[无可匹敌饭量](https://www.luogu.com.cn/user/246099)题目描述
You have an initially empty cauldron, and you want to brew a potion in it. The potion consists of two ingredients: magic essence and water. The potion you want to brew should contain exactly $ k\ \% $ magic essence and $ (100 - k)\ \% $ water. In one step, you can pour either one liter of magic essence or one liter of water into the cauldron. What is the minimum number of steps to brew a potion? You don't care about the total volume of the potion, only about the ratio between magic essence and water in it. A small reminder: if you pour $ e $ liters of essence and $ w $ liters of water ( $ e + w > 0 $ ) into the cauldron, then it contains $ \frac{e}{e + w} \cdot 100\ \% $ (without rounding) magic essence and $ \frac{w}{e + w} \cdot 100\ \% $ water.输入输出格式
输入格式
The first line contains the single $ t $ ( $ 1 \le t \le 100 $ ) — the number of test cases. The first and only line of each test case contains a single integer $ k $ ( $ 1 \le k \le 100 $ ) — the percentage of essence in a good potion.
输出格式
For each test case, print the minimum number of steps to brew a good potion. It can be proved that it's always possible to achieve it in a finite number of steps.
输入输出样例
输入样例 #1
3
3
100
25
输出样例 #1
100
1
4