結果

問題 No.278 連続する整数の和(2)
ユーザー 小指が強い人小指が強い人
提出日時 2015-11-08 14:26:22
言語 Ruby
(3.3.0)
結果
AC  
実行時間 204 ms / 2,000 ms
コード長 273 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 11,556 KB
実行使用メモリ 15,292 KB
最終ジャッジ日時 2023-08-24 22:45:50
合計ジャッジ時間 3,499 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,220 KB
testcase_01 AC 80 ms
15,120 KB
testcase_02 AC 172 ms
15,236 KB
testcase_03 AC 81 ms
15,124 KB
testcase_04 AC 84 ms
15,292 KB
testcase_05 AC 82 ms
15,272 KB
testcase_06 AC 83 ms
15,164 KB
testcase_07 AC 84 ms
15,012 KB
testcase_08 AC 204 ms
15,016 KB
testcase_09 AC 169 ms
15,028 KB
testcase_10 AC 199 ms
15,172 KB
testcase_11 AC 196 ms
15,132 KB
testcase_12 AC 79 ms
15,248 KB
testcase_13 AC 177 ms
15,024 KB
testcase_14 AC 133 ms
15,052 KB
testcase_15 AC 166 ms
15,116 KB
testcase_16 AC 147 ms
15,116 KB
testcase_17 AC 167 ms
15,264 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 then
        next
    end
    if sn % x == 0 then
        res += x
    end
    ax = n / x
    if ax != x && sn % ax == 0 then
        res += ax
    end
end
puts res
0