問題一覧 > 通常問題

No.485 Studying Equations

レベル : / AI推定難易度 : 104 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 754
作問者 : claw88 / テスター : tatuyan_edson
お気に入りにしたユーザー ProblemId : 1535 / 自分の提出
問題文最終更新日: 2026-06-25 04:48:21
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 157 (順位表) の他の問題:

Problem Statement

Kuro-kun is starting to get hooked on solving equations.
Today he will solve many equations of the form $Ax = B$.
Kuro-kun has not learned decimals or fractions at school, so he cannot solve a problem if the solution $x$ is not an integer.

Your job as his private tutor is to prepare the answers before Kuro-kun solves the problems.
Output the solution $x$ if the problem is one Kuro-kun can solve, or "NO" if it is one he cannot solve.

Input

$A$ $B$

$-100\le A \le -1$ or $1\le A \le 100$
$-100\le B \le -1$ or $1\le B \le 100$
$A,\ B$ are integers.

Output

If the solution $x$ of $Ax = B$ is an integer, output the solution $x$; otherwise, output "NO".
Print a newline at the end.

Sample

Sample 1
Input
3 12
Output
4

The $x$ satisfying $3 \times x = 12$ is $4$.
Since $4$ is an integer, this is a problem Kuro-kun can solve.

Sample 2
Input
-2 6
Output
-3

Kuro-kun is used to handling negative numbers.

Sample 3
Input
7 10
Output
NO

This is a problem Kuro-kun cannot solve.

Sample 4
Input
1 -1
Output
-1

There are problems where $A$ or $B$ is $1$ or $-1$, but there are no problems where either is $0$.

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