LoginSignup
0
0

More than 1 year has passed since last update.

はじめに

移植やってます

math.factorial (Python)

_precalc_fact = np.log([math.factorial(n) for n in range(20)])

math.factorial(n) は、nの階乗です。

inject (Ruby)

(1..n).inject(1, :*)

@scivola さんの記事を 【Ruby のまずいコード】階乗 コピペ参照させていただきました。
AtCoderを始めとする競技プログラミングで活用できそうですね。

_precalc_fact = np.log((0...20).map{ |m| (1..m).inject(1, :*) })

メモ

  • Python の math.factorial を学習した
  • 道のりは遠そう
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0