結果

問題 No.376 立方体のN等分 (2)
ユーザー maimai
提出日時 2016-06-04 23:23:09
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 407 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2024-04-17 01:18:52
合計ジャッジ時間 12,148 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
12,416 KB
testcase_01 AC 108 ms
12,544 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 106 ms
12,416 KB
testcase_06 AC 103 ms
12,544 KB
testcase_07 AC 107 ms
12,288 KB
testcase_08 AC 143 ms
12,672 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 155 ms
12,800 KB
testcase_12 WA -
testcase_13 AC 108 ms
12,544 KB
testcase_14 AC 113 ms
12,672 KB
testcase_15 AC 180 ms
12,672 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 176 ms
12,800 KB
testcase_19 WA -
testcase_20 AC 115 ms
12,800 KB
testcase_21 WA -
testcase_22 AC 105 ms
12,416 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 107 ms
12,416 KB
testcase_26 WA -
testcase_27 AC 813 ms
12,800 KB
testcase_28 AC 113 ms
12,800 KB
testcase_29 AC 115 ms
12,800 KB
testcase_30 WA -
testcase_31 AC 313 ms
12,672 KB
testcase_32 AC 809 ms
12,800 KB
testcase_33 AC 1,109 ms
12,800 KB
testcase_34 AC 604 ms
12,672 KB
testcase_35 AC 605 ms
12,672 KB
testcase_36 AC 1,111 ms
12,672 KB
testcase_37 AC 1,105 ms
12,672 KB
testcase_38 AC 374 ms
12,672 KB
testcase_39 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:5: warning: assigned but unused variable - resultL
Syntax OK

ソースコード

diff #

require 'prime'

n=gets.to_i

resultL=nil
resultH=n-1

div=[]
Prime.prime_division(n).each{|e|
    div+=[e[0]]*e[1]
}

div.sort!

if div.size==1
    printf("%d %d",resultH,resultH)
    exit
elsif div.size==2
    printf("%d %d",div[0]+div[1]-2,resultH)
    exit
end

while div.size>3
    a=div.shift
    b=div.shift
    div.unshift(a*b)
    div.sort!
end

printf("%d %d",div[0]+div[1]+div[2]-3,resultH)
exit
0