結果

問題 No.278 連続する整数の和(2)
ユーザー chocoruskchocorusk
提出日時 2019-07-10 20:16:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 242 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-23 23:17:07
合計ジャッジ時間 4,806 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
10,752 KB
testcase_01 WA -
testcase_02 AC 334 ms
10,880 KB
testcase_03 AC 32 ms
10,752 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 37 ms
10,752 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 316 ms
10,880 KB
testcase_10 AC 414 ms
10,752 KB
testcase_11 WA -
testcase_12 AC 30 ms
10,624 KB
testcase_13 WA -
testcase_14 AC 210 ms
10,752 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 319 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def gcd(a, b):
    if b==0:
        return a
    return gcd(b, a%b)
n=int(input())
g=gcd(n*(n+1)//2, n)
ans=0
for i in range(1, n+1):
    if i*i>n:
        break
    if n%i==0:
        ans+=i
        if i*i<n:
            ans+=n//i
print(ans)
0