結果

問題 No.473 和と積の和
ユーザー cielciel
提出日時 2016-12-24 23:09:59
言語 Ruby
(3.3.0)
結果
AC  
実行時間 2,038 ms / 3,000 ms
コード長 250 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 11,368 KB
実行使用メモリ 26,452 KB
最終ジャッジ日時 2023-08-27 06:46:40
合計ジャッジ時間 20,328 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
15,208 KB
testcase_01 AC 95 ms
15,248 KB
testcase_02 AC 95 ms
15,140 KB
testcase_03 AC 805 ms
20,576 KB
testcase_04 AC 94 ms
15,068 KB
testcase_05 AC 96 ms
15,128 KB
testcase_06 AC 93 ms
15,460 KB
testcase_07 AC 94 ms
15,120 KB
testcase_08 AC 93 ms
15,312 KB
testcase_09 AC 95 ms
15,292 KB
testcase_10 AC 94 ms
15,076 KB
testcase_11 AC 96 ms
15,408 KB
testcase_12 AC 95 ms
15,300 KB
testcase_13 AC 94 ms
15,128 KB
testcase_14 AC 94 ms
15,256 KB
testcase_15 AC 96 ms
15,376 KB
testcase_16 AC 93 ms
15,308 KB
testcase_17 AC 93 ms
15,168 KB
testcase_18 AC 96 ms
15,360 KB
testcase_19 AC 94 ms
15,496 KB
testcase_20 AC 95 ms
15,320 KB
testcase_21 AC 94 ms
15,364 KB
testcase_22 AC 95 ms
15,488 KB
testcase_23 AC 102 ms
15,548 KB
testcase_24 AC 108 ms
15,376 KB
testcase_25 AC 2,038 ms
26,452 KB
testcase_26 AC 614 ms
19,688 KB
testcase_27 AC 701 ms
20,116 KB
testcase_28 AC 95 ms
15,496 KB
testcase_29 AC 96 ms
15,404 KB
testcase_30 AC 97 ms
15,420 KB
testcase_31 AC 96 ms
15,400 KB
testcase_32 AC 96 ms
15,252 KB
testcase_33 AC 96 ms
15,340 KB
testcase_34 AC 1,273 ms
22,976 KB
testcase_35 AC 1,285 ms
23,092 KB
testcase_36 AC 96 ms
15,272 KB
testcase_37 AC 97 ms
15,400 KB
testcase_38 AC 1,269 ms
23,456 KB
testcase_39 AC 737 ms
20,428 KB
testcase_40 AC 727 ms
20,124 KB
testcase_41 AC 725 ms
20,316 KB
testcase_42 AC 1,437 ms
23,452 KB
testcase_43 AC 1,431 ms
23,476 KB
testcase_44 AC 1,447 ms
23,564 KB
testcase_45 AC 96 ms
15,196 KB
testcase_46 AC 97 ms
15,456 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require'prime'
n,x=gets.split.map &:to_i
a=(x+=1).prime_division.map{|k,v|(0..v).map{|i|k**i}}
a=a.pop.product(*a).map{|e|e.reduce :*}.sort
m={}
f=->x,n,d{r=0;x<2&&n==0?1:m[[x,n,d]]||=d.downto(1){|i|x%a[i]>0||r+=f[x/a[i],n-1,i]}&&r}
p f[x,n,a.size-1]
0