結果

問題 No.414 衝動
ユーザー 👑 yumechiyumechi
提出日時 2016-08-26 22:25:13
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 203 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2024-04-25 22:54:59
合計ジャッジ時間 3,559 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
12,672 KB
testcase_01 AC 87 ms
12,288 KB
testcase_02 AC 87 ms
12,416 KB
testcase_03 AC 262 ms
12,672 KB
testcase_04 AC 88 ms
12,416 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 267 ms
12,800 KB
testcase_10 RE -
testcase_11 AC 90 ms
12,544 KB
testcase_12 AC 93 ms
12,416 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'

i = gets.chomp.to_i
if Prime.prime?(i)
  aputs "1 #{i}"
else
  arr = i.prime_division.map {|p,n| [p]*n }.flatten
  a = arr.inject {|sum, n| sum * n } / arr[0]
  puts "#{arr[0]} #{a}"
end
0