結果

問題 No.278 連続する整数の和(2)
ユーザー Lycoris_iLycoris_i
提出日時 2015-09-12 01:58:16
言語 Ruby
(3.3.0)
結果
AC  
実行時間 203 ms / 2,000 ms
コード長 173 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 11,556 KB
実行使用メモリ 15,552 KB
最終ジャッジ日時 2023-08-24 22:42:40
合計ジャッジ時間 2,857 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
15,212 KB
testcase_01 AC 90 ms
15,412 KB
testcase_02 AC 203 ms
15,292 KB
testcase_03 AC 88 ms
15,376 KB
testcase_04 AC 89 ms
15,084 KB
testcase_05 AC 89 ms
15,084 KB
testcase_06 AC 89 ms
15,168 KB
testcase_07 AC 89 ms
15,320 KB
testcase_08 AC 90 ms
15,100 KB
testcase_09 AC 91 ms
15,196 KB
testcase_10 AC 91 ms
15,340 KB
testcase_11 AC 104 ms
15,544 KB
testcase_12 AC 90 ms
15,172 KB
testcase_13 AC 164 ms
15,408 KB
testcase_14 AC 96 ms
15,552 KB
testcase_15 AC 133 ms
15,340 KB
testcase_16 AC 98 ms
15,520 KB
testcase_17 AC 97 ms
15,416 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'

n = gets.to_i
a = 1
n.gcd(n * (n - 1) / 2).prime_division.each {|pr|
  f = Array.new
  (pr[1] + 1).times {|i| f << pr[0] ** i}
  a *= f.inject(:+)
}
puts a
0