結果

問題 No.732 3PrimeCounting
ユーザー cielciel
提出日時 2018-09-11 00:11:15
言語 Crystal
(1.11.2)
結果
RE  
実行時間 -
コード長 293 bytes
コンパイル時間 16,692 ms
コンパイル使用メモリ 255,640 KB
実行使用メモリ 6,516 KB
最終ジャッジ日時 2023-09-13 09:49:18
合計ジャッジ時間 21,719 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,388 KB
testcase_01 AC 2 ms
4,396 KB
testcase_02 AC 3 ms
4,400 KB
testcase_03 AC 3 ms
4,476 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 2 ms
4,428 KB
testcase_07 AC 2 ms
4,416 KB
testcase_08 AC 2 ms
4,440 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 3 ms
4,468 KB
testcase_11 AC 2 ms
4,484 KB
testcase_12 AC 3 ms
4,444 KB
testcase_13 AC 2 ms
4,488 KB
testcase_14 AC 2 ms
4,444 KB
testcase_15 AC 3 ms
4,416 KB
testcase_16 AC 2 ms
4,448 KB
testcase_17 AC 2 ms
4,444 KB
testcase_18 AC 2 ms
4,448 KB
testcase_19 AC 2 ms
4,412 KB
testcase_20 AC 3 ms
4,444 KB
testcase_21 AC 3 ms
4,516 KB
testcase_22 AC 3 ms
4,424 KB
testcase_23 AC 3 ms
4,500 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 4 ms
4,548 KB
testcase_26 AC 4 ms
4,456 KB
testcase_27 AC 3 ms
4,516 KB
testcase_28 AC 3 ms
4,456 KB
testcase_29 AC 3 ms
4,432 KB
testcase_30 AC 3 ms
4,580 KB
testcase_31 AC 3 ms
4,496 KB
testcase_32 AC 3 ms
4,540 KB
testcase_33 AC 4 ms
4,568 KB
testcase_34 AC 4 ms
4,452 KB
testcase_35 AC 3 ms
4,420 KB
testcase_36 AC 3 ms
4,528 KB
testcase_37 AC 2 ms
4,456 KB
testcase_38 AC 3 ms
4,380 KB
testcase_39 AC 4 ms
4,536 KB
testcase_40 AC 3 ms
4,408 KB
testcase_41 AC 3 ms
4,480 KB
testcase_42 AC 3 ms
4,548 KB
testcase_43 AC 3 ms
4,404 KB
testcase_44 AC 3 ms
4,520 KB
testcase_45 AC 3 ms
4,380 KB
testcase_46 AC 2 ms
4,392 KB
testcase_47 AC 3 ms
4,420 KB
testcase_48 AC 5 ms
4,560 KB
testcase_49 AC 5 ms
4,560 KB
testcase_50 AC 3 ms
4,520 KB
testcase_51 AC 3 ms
4,500 KB
testcase_52 AC 3 ms
4,404 KB
testcase_53 AC 9 ms
4,656 KB
testcase_54 RE -
testcase_55 RE -
testcase_56 RE -
testcase_57 AC 28 ms
4,804 KB
testcase_58 AC 27 ms
4,880 KB
testcase_59 AC 10 ms
4,624 KB
testcase_60 AC 42 ms
4,904 KB
testcase_61 AC 42 ms
4,924 KB
testcase_62 RE -
testcase_63 RE -
testcase_64 AC 54 ms
5,020 KB
testcase_65 AC 54 ms
5,096 KB
testcase_66 AC 2 ms
4,496 KB
testcase_67 AC 2 ms
4,464 KB
testcase_68 RE -
testcase_69 RE -
testcase_70 RE -
testcase_71 RE -
testcase_72 RE -
testcase_73 RE -
testcase_74 RE -
testcase_75 AC 4 ms
4,464 KB
testcase_76 RE -
testcase_77 AC 30 ms
4,820 KB
testcase_78 RE -
testcase_79 RE -
testcase_80 RE -
testcase_81 RE -
testcase_82 AC 3 ms
4,388 KB
testcase_83 AC 29 ms
4,824 KB
testcase_84 AC 33 ms
4,784 KB
testcase_85 RE -
testcase_86 RE -
testcase_87 RE -
testcase_88 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n=gets.not_nil!.to_i
t=[true]*(3*n+1)
t[0]=t[1]=false
(2...t.size).each{|i|
	if t[i]
		(i*2).step(to: t.size-1,by: i){|j|t[j]=false}
	end
}
q=(2...t.size).select{|i|t[i]}
o=q.dup
r=0
a=[0]*t.size
q.each{|c|
	break if c>n
	o.each{|s|r+=a[s-c]}
	o.shift
	q.each{|x|break if x>=c;a[x+c]+=1}
}
p r
0