結果

問題 No.843 Triple Primes
ユーザー maimai
提出日時 2019-06-28 22:17:35
言語 Ruby
(3.2.2)
結果
AC  
実行時間 245 ms / 2,000 ms
コード長 193 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 11,840 KB
実行使用メモリ 19,180 KB
最終ジャッジ日時 2023-10-19 17:44:07
合計ジャッジ時間 9,984 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
16,208 KB
testcase_01 AC 245 ms
19,120 KB
testcase_02 AC 104 ms
16,212 KB
testcase_03 AC 102 ms
16,212 KB
testcase_04 AC 106 ms
16,392 KB
testcase_05 AC 103 ms
16,212 KB
testcase_06 AC 102 ms
16,392 KB
testcase_07 AC 238 ms
19,120 KB
testcase_08 AC 239 ms
19,120 KB
testcase_09 AC 243 ms
19,120 KB
testcase_10 AC 239 ms
19,120 KB
testcase_11 AC 240 ms
19,120 KB
testcase_12 AC 244 ms
19,120 KB
testcase_13 AC 242 ms
19,120 KB
testcase_14 AC 240 ms
19,120 KB
testcase_15 AC 241 ms
19,120 KB
testcase_16 AC 243 ms
19,120 KB
testcase_17 AC 102 ms
16,212 KB
testcase_18 AC 103 ms
16,212 KB
testcase_19 AC 101 ms
16,212 KB
testcase_20 AC 139 ms
17,268 KB
testcase_21 AC 120 ms
16,772 KB
testcase_22 AC 174 ms
17,772 KB
testcase_23 AC 175 ms
17,768 KB
testcase_24 AC 141 ms
17,268 KB
testcase_25 AC 138 ms
17,268 KB
testcase_26 AC 241 ms
19,120 KB
testcase_27 AC 109 ms
16,512 KB
testcase_28 AC 241 ms
19,120 KB
testcase_29 AC 137 ms
17,268 KB
testcase_30 AC 242 ms
19,120 KB
testcase_31 AC 114 ms
16,512 KB
testcase_32 AC 106 ms
16,392 KB
testcase_33 AC 137 ms
17,268 KB
testcase_34 AC 175 ms
17,768 KB
testcase_35 AC 240 ms
19,120 KB
testcase_36 AC 121 ms
16,772 KB
testcase_37 AC 177 ms
17,768 KB
testcase_38 AC 173 ms
17,768 KB
testcase_39 AC 239 ms
19,180 KB
testcase_40 AC 100 ms
16,220 KB
testcase_41 AC 100 ms
16,212 KB
testcase_42 AC 243 ms
19,120 KB
testcase_43 AC 240 ms
19,120 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'
n = gets.to_i
if n == 1
  p 0
  exit 0
end

pli = Prime.take_while{|e| e <= n}.select{|q| 
  z = q+2
  h = Math.sqrt(z).to_i
  q != 2 && h**2 == z && h.prime?
}

p pli.size*2+1
0