結果

問題 No.458 異なる素数の和
ユーザー cielciel
提出日時 2016-12-09 01:17:28
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 138 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,928 KB
最終ジャッジ日時 2024-05-06 09:56:07
合計ジャッジ時間 19,719 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
12,288 KB
testcase_01 AC 795 ms
12,544 KB
testcase_02 AC 1,013 ms
12,672 KB
testcase_03 AC 250 ms
12,416 KB
testcase_04 AC 287 ms
12,288 KB
testcase_05 TLE -
testcase_06 AC 1,072 ms
12,544 KB
testcase_07 AC 98 ms
12,160 KB
testcase_08 TLE -
testcase_09 AC 140 ms
12,416 KB
testcase_10 AC 94 ms
12,416 KB
testcase_11 TLE -
testcase_12 AC 89 ms
12,160 KB
testcase_13 AC 86 ms
12,416 KB
testcase_14 AC 88 ms
12,416 KB
testcase_15 AC 87 ms
12,288 KB
testcase_16 AC 174 ms
12,160 KB
testcase_17 AC 86 ms
12,288 KB
testcase_18 AC 87 ms
12,416 KB
testcase_19 AC 87 ms
12,416 KB
testcase_20 AC 90 ms
12,416 KB
testcase_21 AC 87 ms
12,544 KB
testcase_22 AC 86 ms
12,416 KB
testcase_23 AC 88 ms
12,288 KB
testcase_24 AC 88 ms
12,416 KB
testcase_25 AC 86 ms
12,160 KB
testcase_26 AC 90 ms
12,416 KB
testcase_27 AC 923 ms
12,672 KB
testcase_28 TLE -
testcase_29 AC 109 ms
12,416 KB
testcase_30 AC 603 ms
12,544 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'
n=gets.to_i
a=[0]*(n+1)
a[0]=1
Prime.each(n){|e|
	n.downto(e){|i|
		a[i]=a[i-e]+1 if a[i-e]>0&&a[i]<a[i-e]+1
	}
}
p a[n]-1
0