問題一覧 > 教育的問題

No.3352 Midpoint Check

レベル : / AI推定難易度 : 115 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 74
作問者 : 👑 p-adic / テスター : yu23578
お気に入りにしたユーザー ProblemId : 12329 / 自分の提出
問題文最終更新日: 2025-09-15 19:34:06
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 488 小数誤差コンテスト (順位表) の他の問題:

Problem Statement

You are given $3$ distinct integers $P, Q, R$.

Determine whether $Q$ is equal to the midpoint $\frac{P+R}{2}$ of $P, R$.

Input

The input is given from standard input on $1$ line in the following format:

  • The $1$st line contains $P, Q, R$, separated by single spaces.
$P$ $Q$ $R$

Constraints

The input satisfies the following constraints:

  • $P$ is an integer satisfying $-10 \leq P \leq 10$.
  • $Q$ is an integer satisfying $-10 \leq Q \leq 10$.
  • $R$ is an integer satisfying $-10 \leq R \leq 10$.
  • $P, Q, R$ are distinct.

Output

Print Yes if $Q$ is equal to the midpoint $\frac{P+R}{2}$ of $P, R$, and print No otherwise.

Print a newline at the end.

Sample

Sample 1
Input
-1 0 1
Output
Yes

We have $\frac{P + R}{2} = \frac{(-1) + 1}{2} = 0 = Q$.

Sample 2
Input
4 2 0
Output
Yes

We have $\frac{P + R}{2} = \frac{4 + 0}{2} = 2 = Q$.

Sample 3
Input
0 -1 2
Output
No

We have $\frac{P + R}{2} = \frac{0 + 2}{2} = 1 \neq -1 = Q$.

Sample 4
Input
0 1 3
Output
No

We have $\frac{P + R}{2} = \frac{0 + 3}{2} = 1.5 \neq 1 = Q$.

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