結果

問題 No.278 連続する整数の和(2)
ユーザー
提出日時 2015-10-23 17:51:29
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 163 bytes
コンパイル時間 56 ms
コンパイル使用メモリ 11,436 KB
実行使用メモリ 15,324 KB
最終ジャッジ日時 2023-09-29 17:41:35
合計ジャッジ時間 2,933 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,192 KB
testcase_01 AC 83 ms
15,088 KB
testcase_02 AC 161 ms
15,172 KB
testcase_03 AC 78 ms
15,168 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 84 ms
15,088 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 155 ms
15,276 KB
testcase_10 AC 175 ms
15,088 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 127 ms
15,100 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 154 ms
15,152 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.chomp.to_i

if n % 2 == 0
  puts 1
else
  m = Math.sqrt(n).floor

  sum = 0
  (1 .. m).each do |i|
    sum += i + n / i if n % i  == 0
  end

puts sum
end
0