No.278 Sum of Consecutive Integers (2)
レベル :
/ AI推定難易度 : 1000
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 256 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 196
作問者 :
koyumeishi
タグ : / 解いたユーザー数 196
作問者 :
koyumeishi
問題文最終更新日: 2026-06-26 21:13:15
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 120
(順位表)
の他の問題:
Problem Statement
In junior high school mathematics, one proves that the proposition "the sum of $3$ consecutive positive integers is divisible by $3$" is true.
Generalizing this a little, consider the following proposition.
The sum of $N$ consecutive positive integers is divisible by $X$.
Given a positive integer $N$, find the sum of all positive integers $X$ for which this proposition is true.Input
$N$
$N$ ($1\leq N \leq 2 \times 10^{12}$) is given on one line.
Output
$\sum X$
Output on one line the sum of the positive integers $X$ that make the proposition true.
Sample
Sample 1
Input
3
Output
4
The proposition is true for $X=1,3$, so the answer is $1+3=4$.
Sample 2
Input
2
Output
1
The proposition is true only for $X=1$.
Sample 3
Input
1145148931919
Output
1145148931920
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。