結果

問題 No.276 連続する整数の和(1)
ユーザー 小指が強い人小指が強い人
提出日時 2015-11-08 15:31:23
言語 Ruby
(3.1.1p18 )
結果
AC  
実行時間 68 ms / 1,000 ms
コード長 136 bytes
コンパイル時間 25 ms
使用メモリ 14,080 KB
最終ジャッジ日時 2023-02-25 18:12:19
合計ジャッジ時間 1,632 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 68 ms
14,080 KB
testcase_01 AC 64 ms
13,716 KB
testcase_02 AC 66 ms
13,852 KB
testcase_03 AC 66 ms
13,944 KB
testcase_04 AC 66 ms
13,956 KB
testcase_05 AC 68 ms
13,848 KB
testcase_06 AC 68 ms
13,760 KB
testcase_07 AC 67 ms
13,792 KB
testcase_08 AC 67 ms
13,944 KB
testcase_09 AC 67 ms
13,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
sn = n * (n - 1) / 2
while true do
    m = sn % n
    if m == 0 then
        break
    end
    sn = n
    n = m
end
puts n
0