No.682 Average
問題文最終更新日: 2026-06-26 06:06:58
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 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もしくは右上の雲マークをクリックしてアカウントを作成してください。
Pulmn
WA_TLE