結果

問題 No.458 異なる素数の和
ユーザー hogeover30hogeover30
提出日時 2016-12-28 14:23:06
言語 Ruby
(3.3.0)
結果
AC  
実行時間 449 ms / 2,000 ms
コード長 115 bytes
コンパイル時間 38 ms
コンパイル使用メモリ 11,196 KB
実行使用メモリ 15,796 KB
最終ジャッジ日時 2023-09-18 15:14:48
合計ジャッジ時間 6,832 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
15,348 KB
testcase_01 AC 279 ms
15,396 KB
testcase_02 AC 314 ms
15,408 KB
testcase_03 AC 173 ms
15,308 KB
testcase_04 AC 185 ms
15,596 KB
testcase_05 AC 418 ms
15,408 KB
testcase_06 AC 304 ms
15,424 KB
testcase_07 AC 99 ms
15,304 KB
testcase_08 AC 421 ms
15,348 KB
testcase_09 AC 136 ms
15,340 KB
testcase_10 AC 93 ms
15,348 KB
testcase_11 AC 447 ms
15,796 KB
testcase_12 AC 94 ms
15,336 KB
testcase_13 AC 95 ms
15,220 KB
testcase_14 AC 95 ms
15,108 KB
testcase_15 AC 90 ms
15,196 KB
testcase_16 AC 150 ms
15,436 KB
testcase_17 AC 93 ms
15,204 KB
testcase_18 AC 92 ms
15,640 KB
testcase_19 AC 94 ms
15,160 KB
testcase_20 AC 92 ms
15,292 KB
testcase_21 AC 93 ms
15,328 KB
testcase_22 AC 94 ms
15,340 KB
testcase_23 AC 92 ms
15,424 KB
testcase_24 AC 94 ms
15,140 KB
testcase_25 AC 92 ms
15,280 KB
testcase_26 AC 93 ms
15,192 KB
testcase_27 AC 300 ms
15,576 KB
testcase_28 AC 449 ms
15,680 KB
testcase_29 AC 118 ms
15,048 KB
testcase_30 AC 252 ms
15,576 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require'prime'
d=0,*[-1]*n=gets.to_i
Prime.each(999){|p|n.downto(p){|i|d[i-p]>=0&&d[i]=[d[i],d[i-p]+1].max}}
p d[n]
0