結果

問題 No.888 約数の総和
ユーザー wonda_t_coffeewonda_t_coffee
提出日時 2020-02-04 23:37:44
言語 Ruby
(3.2.2)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 181 bytes
コンパイル時間 49 ms
コンパイル使用メモリ 11,884 KB
実行使用メモリ 24,364 KB
最終ジャッジ日時 2023-10-21 06:41:41
合計ジャッジ時間 5,924 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
16,164 KB
testcase_01 AC 86 ms
16,164 KB
testcase_02 AC 88 ms
16,168 KB
testcase_03 AC 87 ms
16,072 KB
testcase_04 AC 88 ms
16,164 KB
testcase_05 AC 88 ms
16,168 KB
testcase_06 AC 89 ms
16,164 KB
testcase_07 AC 88 ms
16,164 KB
testcase_08 AC 86 ms
16,164 KB
testcase_09 AC 86 ms
16,168 KB
testcase_10 AC 86 ms
16,168 KB
testcase_11 AC 86 ms
16,172 KB
testcase_12 AC 87 ms
16,172 KB
testcase_13 AC 86 ms
16,172 KB
testcase_14 AC 87 ms
16,176 KB
testcase_15 AC 86 ms
16,176 KB
testcase_16 AC 88 ms
16,176 KB
testcase_17 AC 85 ms
16,176 KB
testcase_18 AC 200 ms
24,364 KB
testcase_19 AC 173 ms
22,268 KB
testcase_20 AC 148 ms
20,768 KB
testcase_21 AC 195 ms
24,100 KB
testcase_22 AC 199 ms
24,364 KB
testcase_23 AC 90 ms
16,512 KB
testcase_24 AC 131 ms
19,712 KB
testcase_25 AC 143 ms
20,504 KB
testcase_26 AC 145 ms
20,504 KB
testcase_27 AC 171 ms
22,516 KB
testcase_28 AC 177 ms
22,568 KB
testcase_29 AC 177 ms
22,780 KB
testcase_30 AC 180 ms
23,044 KB
testcase_31 AC 191 ms
23,580 KB
testcase_32 AC 200 ms
24,364 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.chomp.to_i
ans = 0
lim = n**0.5
# puts "lim = #{lim}"
(1..lim.to_i).to_a.each do |d|
  next if n % d > 0
  ans += d + n / d
end

ans -= lim.to_i if lim == lim.to_i
puts ans
0