結果

問題 No.371 ぼく悪いプライムじゃないよ
ユーザー simansiman
提出日時 2023-03-01 18:24:49
言語 Ruby
(3.3.0)
結果
AC  
実行時間 202 ms / 1,000 ms
コード長 244 bytes
コンパイル時間 474 ms
コンパイル使用メモリ 11,316 KB
実行使用メモリ 15,872 KB
最終ジャッジ日時 2023-10-14 22:24:34
合計ジャッジ時間 8,411 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
15,148 KB
testcase_01 AC 88 ms
15,188 KB
testcase_02 AC 87 ms
15,164 KB
testcase_03 AC 87 ms
15,252 KB
testcase_04 AC 88 ms
15,268 KB
testcase_05 AC 89 ms
15,228 KB
testcase_06 AC 87 ms
15,216 KB
testcase_07 AC 90 ms
15,240 KB
testcase_08 AC 92 ms
15,312 KB
testcase_09 AC 91 ms
15,112 KB
testcase_10 AC 92 ms
15,352 KB
testcase_11 AC 90 ms
15,320 KB
testcase_12 AC 89 ms
15,280 KB
testcase_13 AC 90 ms
15,356 KB
testcase_14 AC 90 ms
15,168 KB
testcase_15 AC 90 ms
15,312 KB
testcase_16 AC 91 ms
15,276 KB
testcase_17 AC 90 ms
15,108 KB
testcase_18 AC 89 ms
15,120 KB
testcase_19 AC 90 ms
15,276 KB
testcase_20 AC 91 ms
15,248 KB
testcase_21 AC 89 ms
15,532 KB
testcase_22 AC 95 ms
15,364 KB
testcase_23 AC 90 ms
15,320 KB
testcase_24 AC 119 ms
15,732 KB
testcase_25 AC 117 ms
15,644 KB
testcase_26 AC 107 ms
15,684 KB
testcase_27 AC 118 ms
15,816 KB
testcase_28 AC 126 ms
15,700 KB
testcase_29 AC 202 ms
15,716 KB
testcase_30 AC 128 ms
15,772 KB
testcase_31 AC 129 ms
15,828 KB
testcase_32 AC 128 ms
15,820 KB
testcase_33 AC 135 ms
15,552 KB
testcase_34 AC 129 ms
15,872 KB
testcase_35 AC 127 ms
15,656 KB
testcase_36 AC 123 ms
15,836 KB
testcase_37 AC 138 ms
15,752 KB
testcase_38 AC 126 ms
15,816 KB
testcase_39 AC 128 ms
15,620 KB
testcase_40 AC 121 ms
15,624 KB
testcase_41 AC 122 ms
15,568 KB
testcase_42 AC 119 ms
15,804 KB
testcase_43 AC 154 ms
15,660 KB
testcase_44 AC 111 ms
15,800 KB
testcase_45 AC 88 ms
15,112 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'

L, H = gets.split.map(&:to_i)

primes = Prime.each(Math.sqrt(H)).to_a.reverse

primes.each do |x|
  y = H / x
  n = y * x

  while n >= L
    if n.prime_division[0][0] >= x
      puts n
      exit
    end

    n -= x
  end
end
0