問題一覧 > 通常問題

No.682 Average

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 437
作問者 : Pulmn / テスター : WA_TLE
お気に入りにしたユーザー ProblemId : 2256 / 自分の提出
問題文最終更新日: 2026-06-26 06:06:58
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 190 (順位表) の他の問題:

Problem Statement

You are given natural numbers $A,B\ (A\le B)$. Find the number of $i$ with $A\le i\le B$ such that the average of the $3$ numbers $\{A,B,i\}$ is an integer.

Input

$A$ $B$

$1\le A\le B\le 100$

Output

Output the number of $i$ with $A\le i\le B$ such that the average of the $3$ numbers $\{A,B,i\}$ is an integer. Print a newline at the end.

Sample

Sample 1
Input
2 8
Output
3

When $i=2$, the average of $\{A,B,i\}$ is $(2+8+2)/3=4$, which is an integer.
When $i=3$, the average of $\{A,B,i\}$ is $(2+8+3)/3=4.33\cdots$, which is not an integer.

Sample 2
Input
2 3
Output
0

Sample 3
Input
1 100
Output
34

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