結果
| 問題 | 
                            No.888 約数の総和
                             | 
                    
| コンテスト | |
| ユーザー | 
                             wonda_t_coffee
                         | 
                    
| 提出日時 | 2020-02-04 23:37:44 | 
| 言語 | Ruby  (3.4.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 195 ms / 2,000 ms | 
| コード長 | 181 bytes | 
| コンパイル時間 | 67 ms | 
| コンパイル使用メモリ | 7,552 KB | 
| 実行使用メモリ | 22,528 KB | 
| 最終ジャッジ日時 | 2024-09-21 07:51:33 | 
| 合計ジャッジ時間 | 5,116 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 30 | 
コンパイルメッセージ
Syntax OK
ソースコード
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
            
            
            
        
            
wonda_t_coffee