No.982 Add
問題文最終更新日: 2020-02-11 13:27:15
English (AI translation)
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 236
(順位表)
の他の問題:
Problem Statement
You are given positive integers $A,B$.
We define $N$ to be a good integer if and only if there exist non-negative integers $x,y$ such that $N=Ax+By$.
Find the number of positive integers that are not good integers.
However, if the number of such integers is not finite, output $-1$.
Input
$A\ B$
$1 \leq A,B \leq 100$
All inputs are integers.
Output
Output the answer on a single line.
Sample
Sample 1
Input
1 2
Output
0
Sample 2
Input
4 18
Output
-1
Sample 3
Input
21 16
Output
150
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
tubuann1
beet