結果

問題 No.575 n! / m / m / m...
ユーザー 0w10w1
提出日時 2017-11-03 21:45:27
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 351 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2024-05-02 04:58:10
合計ジャッジ時間 5,627 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
12,544 KB
testcase_01 AC 126 ms
12,672 KB
testcase_02 AC 128 ms
12,544 KB
testcase_03 AC 105 ms
12,672 KB
testcase_04 AC 107 ms
12,544 KB
testcase_05 WA -
testcase_06 AC 118 ms
12,544 KB
testcase_07 AC 109 ms
12,416 KB
testcase_08 AC 107 ms
12,416 KB
testcase_09 AC 113 ms
12,416 KB
testcase_10 AC 111 ms
12,544 KB
testcase_11 AC 106 ms
12,416 KB
testcase_12 AC 106 ms
12,544 KB
testcase_13 AC 112 ms
12,416 KB
testcase_14 AC 108 ms
12,416 KB
testcase_15 AC 105 ms
12,416 KB
testcase_16 AC 109 ms
12,672 KB
testcase_17 AC 109 ms
12,544 KB
testcase_18 AC 111 ms
12,800 KB
testcase_19 AC 107 ms
12,416 KB
testcase_20 AC 109 ms
12,416 KB
testcase_21 AC 107 ms
12,544 KB
testcase_22 WA -
testcase_23 AC 219 ms
12,800 KB
testcase_24 WA -
testcase_25 AC 213 ms
12,800 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'
N, M = gets.split.map &:to_i
pes = Prime.prime_division(M)
k = pes.map { |pe| 
  f = lambda do |n, p|
    r = 0
    until n < p
      r += n / p
      p *= p
    end
    r
  end
  f[N, pe[0]] / pe[1]
} .min
log10ans = Math.lgamma(N + 1)[0] / Math.log(10) - k * Math.log10(M)
puts "#{10 ** (log10ans - log10ans.to_i)}e#{log10ans.to_i}"
0