問題一覧 > 通常問題

No.338 Survey Feature

レベル : / AI推定難易度 : 900 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 276
作問者 : buko106
お気に入りにしたユーザー ProblemId : 814 / 自分の提出
問題文最終更新日: 2026-06-25 01:33:57
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 130 (順位表) の他の問題:

Problem Statement

A certain site used its survey feature to conduct a two-choice "Yes" or "No" survey. There was at least one response, and as a result, $A$% of people answered "Yes" and $B$% answered "No".

Here, $A,B$ are values rounded to the nearest integer (fractional part rounded half up). That is, if $a$ people voted "Yes" and $b$ people voted "No", then $A,B$ are the values of $\displaystyle \frac{100a}{a+b},\frac{100b}{a+b}$ rounded to the nearest integer (fractional part rounded half up).

Given integers $A$ and $B$, among the pairs $(a,b)$ for which this result holds, find one that minimizes the total number of respondents $a+b$ (where $a+b \geq 1$).

Input

A B

$0 \leq A \leq 100$
$0 \leq B \leq 100$
It is guaranteed that there exists a pair $(a,b)$ for which the result is $A$%, $B$%.

Output

Output the minimum value of $a+b$ satisfying the conditions on one line. Print a newline at the end.

Sample

Sample 1
Input
50 50
Output
2


When a=b=1, a+b is minimized.

Sample 2
Input
1 99
Output
67


This is the case a=1,b=66.

Sample 3
Input
3 98
Output
40


When a=1,b=39, we have 100a/(a+b)=2.5,100b/(a+b)=97.5, so a pair (a,b) satisfying the input does indeed exist.
Note that A+B=100 does not necessarily hold.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。