結果

問題 No.276 連続する整数の和(1)
ユーザー akanayaakanaya
提出日時 2020-04-05 14:53:47
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 15 ms / 1,000 ms
コード長 146 bytes
コンパイル時間 77 ms
使用メモリ 7,768 KB
最終ジャッジ日時 2023-02-04 09:40:33
合計ジャッジ時間 1,089 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 15 ms
7,692 KB
testcase_01 AC 15 ms
7,664 KB
testcase_02 AC 14 ms
7,556 KB
testcase_03 AC 14 ms
7,660 KB
testcase_04 AC 15 ms
7,560 KB
testcase_05 AC 14 ms
7,712 KB
testcase_06 AC 14 ms
7,768 KB
testcase_07 AC 14 ms
7,672 KB
testcase_08 AC 15 ms
7,612 KB
testcase_09 AC 14 ms
7,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

r = n * (n - 1) // 2

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


print(gcd(n, r))

0