結果

問題 No.278 連続する整数の和(2)
ユーザー 小指が強い人小指が強い人
提出日時 2015-11-08 13:55:52
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 241 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 11,480 KB
実行使用メモリ 15,352 KB
最終ジャッジ日時 2023-10-11 15:19:45
合計ジャッジ時間 3,664 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,076 KB
testcase_01 AC 84 ms
15,228 KB
testcase_02 AC 175 ms
15,280 KB
testcase_03 AC 81 ms
15,292 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 84 ms
15,148 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 166 ms
15,088 KB
testcase_10 AC 192 ms
15,036 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 136 ms
15,248 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 170 ms
15,132 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
sn = n * (n - 1) / 2
t = Math.sqrt(n).to_i
res = 0
t.times do |x|
    x += 1
    if n % x != 0 || sn % x != 0 then
        next
    end
    res += x
    ax = n / x
    if sn % ax == 0 then
        res += ax
    end
end
puts res
0