結果

問題 No.458 異なる素数の和
ユーザー hogeover30hogeover30
提出日時 2016-12-28 18:56:32
言語 Ruby
(3.3.0)
結果
AC  
実行時間 249 ms / 2,000 ms
コード長 108 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 11,508 KB
実行使用メモリ 15,792 KB
最終ジャッジ日時 2023-09-18 15:15:35
合計ジャッジ時間 5,553 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
15,104 KB
testcase_01 AC 176 ms
15,440 KB
testcase_02 AC 192 ms
15,536 KB
testcase_03 AC 131 ms
15,432 KB
testcase_04 AC 136 ms
15,380 KB
testcase_05 AC 237 ms
15,704 KB
testcase_06 AC 189 ms
15,452 KB
testcase_07 AC 95 ms
15,192 KB
testcase_08 AC 234 ms
15,568 KB
testcase_09 AC 111 ms
15,552 KB
testcase_10 AC 92 ms
15,364 KB
testcase_11 AC 249 ms
15,648 KB
testcase_12 AC 92 ms
15,332 KB
testcase_13 AC 92 ms
15,252 KB
testcase_14 AC 93 ms
15,092 KB
testcase_15 AC 92 ms
15,208 KB
testcase_16 AC 120 ms
15,296 KB
testcase_17 AC 93 ms
15,372 KB
testcase_18 AC 94 ms
15,288 KB
testcase_19 AC 94 ms
15,332 KB
testcase_20 AC 91 ms
15,236 KB
testcase_21 AC 91 ms
15,280 KB
testcase_22 AC 91 ms
15,188 KB
testcase_23 AC 92 ms
15,184 KB
testcase_24 AC 94 ms
15,192 KB
testcase_25 AC 92 ms
15,376 KB
testcase_26 AC 91 ms
15,376 KB
testcase_27 AC 184 ms
15,552 KB
testcase_28 AC 245 ms
15,792 KB
testcase_29 AC 105 ms
15,296 KB
testcase_30 AC 162 ms
15,444 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#!ruby -nrprime
d=*[-1]*n=$_.to_i,0
Prime.each(499){|p|p.upto(n){|i|t=d[i]+1;t>0&&d[i-=p]<t&&d[i]=t}}
p d[0]
0