結果

問題 No.371 ぼく悪いプライムじゃないよ
ユーザー maimai
提出日時 2018-05-20 10:50:29
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 268 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 11,548 KB
実行使用メモリ 15,616 KB
最終ジャッジ日時 2023-09-10 23:54:55
合計ジャッジ時間 6,907 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
15,256 KB
testcase_01 AC 90 ms
15,360 KB
testcase_02 AC 89 ms
15,400 KB
testcase_03 WA -
testcase_04 AC 92 ms
15,152 KB
testcase_05 AC 91 ms
15,292 KB
testcase_06 AC 92 ms
15,232 KB
testcase_07 AC 90 ms
15,372 KB
testcase_08 WA -
testcase_09 AC 91 ms
15,292 KB
testcase_10 AC 89 ms
15,348 KB
testcase_11 AC 90 ms
15,408 KB
testcase_12 AC 90 ms
15,320 KB
testcase_13 AC 89 ms
15,336 KB
testcase_14 AC 91 ms
15,412 KB
testcase_15 WA -
testcase_16 AC 88 ms
15,096 KB
testcase_17 AC 88 ms
15,160 KB
testcase_18 AC 88 ms
15,124 KB
testcase_19 AC 89 ms
15,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 150 ms
15,616 KB
testcase_27 AC 89 ms
15,192 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def ascan; gets.split.map(&:to_i);end

require 'prime'

L, H = ascan

sqrtH = Math.sqrt(H).to_i

sqrtH.downto(2) do |x|
    next unless x.prime? ## 篩を使えばこの計算量をループの外に出せる
    y = H / x
    next if x * y < L
    p x*y
    break
end
0