問題一覧 > 通常問題

No.1048 Zero (Advanced)

レベル : / AI推定難易度 : 850 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 277
作問者 : stoq / テスター : tran0826
お気に入りにしたユーザー ProblemId : 4117 / 自分の提出
問題文最終更新日: 2020-05-07 17:15:20
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 247 (順位表) の他の問題:

Problem Statement

T-kun has an integer $N$. Initially, $N=0$.
T-kun performs the following operation $K$ times.

- Choose one integer $i \ (L \leq i \leq R)$. Then, replace $N$ with the remainder when $N+i$ is divided by $M$.

Does there exist a sequence of operations such that $N=0$ holds again after the $K$ operations? If one exists, print Yes; otherwise, print No.

Input

$L\ R\ M\ K$

$L,R,M,K$ are integers.
$0 \leq L \leq R \leq 10^9$
$1 \leq M \leq 10^9$
$0 \leq K \leq 10^9$

Output

If a sequence of operations satisfying the condition exists, print Yes; otherwise, print No. Print a newline at the end.

Sample

Sample 1
Input
3 7 5 2
Output
Yes

For example, if you choose $i = 3$ in the first operation and $i = 7$ in the second operation, $N$ changes as $0 \to 3 \to 0$.

Sample 2
Input
2 3 4 1
Output
No

No matter how you choose $i$, you never get $N=0$.

Sample 3
Input
2 3 4 0
Output
Yes

No operation is performed, so $N=0$ remains as it is.

Sample 4
Input
10 53 100 2
Output
Yes

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