r774. Game
Tags : Zaim
Accepted rate: 12人/ 12人 ( 100%) [非即時]
評分方式:
Tolerant

最近更新 : 2026-02-03 16:44

Content

Zzzz was secretly playing Spider Solitaire. Sometimes he won, sometimes he lost. Feeling someone's gaze, he stopped playing and started coding. Believing he'd evaded suspicion, he resumed the game. Then, during his brief coding stint, he noticed a noticeable improvement in his gaming skills.

Now, Zzzz won't lose in any future games. However, since he can't delete his game records, he believes his poor performances from the past don't prove his current prowess.

The game record looks like this:

  • Number of games: X
  • Games won: Y (Z%)
  • Z is Zzzz's winning percentage, with the decimal point removed. For example, if X=53 and Y=47, then Z=88.

Given X and Y, write a program to find the minimum number of times Zzzz must play the game before Z changes.

Input

Each line contains integers X and Y.

0<=X, Y<=10^9

Output

On the first line, print the minimum number of rounds Zzzz needs to play. If Z never changes, print -1.

Sample Input #1
10 8
Sample Output #1
1
Sample Input #2
100 80
Sample Output #2
6
Sample Input #3
47 47
Sample Output #3
-1
Sample Input #4
99000 0
Sample Output #4
1000
測資資訊:
記憶體限制: 128 MB
不公開 測資點#0 (5%): 0.5s , <1K
不公開 測資點#1 (5%): 0.5s , <1K
不公開 測資點#2 (5%): 0.5s , <1K
不公開 測資點#3 (5%): 0.5s , <1K
不公開 測資點#4 (5%): 0.5s , <1K
不公開 測資點#5 (5%): 0.5s , <1K
不公開 測資點#6 (5%): 0.5s , <1K
不公開 測資點#7 (5%): 0.5s , <1K
不公開 測資點#8 (5%): 0.5s , <1K
不公開 測資點#9 (5%): 0.5s , <1K
不公開 測資點#10 (5%): 0.5s , <1K
不公開 測資點#11 (5%): 0.5s , <1K
不公開 測資點#12 (5%): 0.5s , <1K
不公開 測資點#13 (5%): 0.5s , <1K
不公開 測資點#14 (5%): 0.5s , <1K
不公開 測資點#15 (5%): 0.5s , <1K
不公開 測資點#16 (5%): 0.5s , <1K
不公開 測資點#17 (5%): 0.5s , <1K
不公開 測資點#18 (5%): 0.5s , <1K
不公開 測資點#19 (5%): 0.5s , <1K
Hint :
Tags:
Zaim
出處:
[管理者: chenwei98050 ... (陳維(Z)) ]

Status Forum 排行

ID User Problem Subject Hit Post Date
54515 kita197 (aries) r774
C++ 解答
62 2026-02-04 15:29