結果

問題 No.276 連続する整数の和(1)
ユーザー yumechiyumechi
提出日時 2015-10-24 09:52:28
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 14 ms / 1,000 ms
コード長 188 bytes
コンパイル時間 53 ms
使用メモリ 9,680 KB
最終ジャッジ日時 2023-02-24 21:12:47
合計ジャッジ時間 1,030 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 14 ms
7,700 KB
testcase_01 AC 13 ms
7,680 KB
testcase_02 AC 12 ms
7,672 KB
testcase_03 AC 13 ms
9,680 KB
testcase_04 AC 14 ms
7,720 KB
testcase_05 AC 13 ms
7,768 KB
testcase_06 AC 13 ms
7,776 KB
testcase_07 AC 13 ms
7,664 KB
testcase_08 AC 13 ms
7,680 KB
testcase_09 AC 13 ms
9,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def gcd(x, y):
    if x < y:
        x, y = y, x
    while y > 0:
        r = x % y
        x = y
        y = r
    return x

n = int(input())
n1, n2 = n, n * (n-1) // 2
print(gcd(n1, n2))
0