結果

問題 No.287 場合の数
ユーザー rkato5680rkato5680
提出日時 2020-09-25 18:29:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 143 ms / 5,000 ms
コード長 335 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 10,704 KB
実行使用メモリ 29,952 KB
最終ジャッジ日時 2023-09-10 14:39:52
合計ジャッジ時間 8,189 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
29,816 KB
testcase_01 AC 139 ms
29,604 KB
testcase_02 AC 136 ms
29,584 KB
testcase_03 AC 138 ms
29,920 KB
testcase_04 AC 138 ms
29,668 KB
testcase_05 AC 139 ms
29,680 KB
testcase_06 AC 139 ms
29,480 KB
testcase_07 AC 141 ms
29,752 KB
testcase_08 AC 142 ms
29,800 KB
testcase_09 AC 143 ms
29,832 KB
testcase_10 AC 141 ms
29,664 KB
testcase_11 AC 140 ms
29,788 KB
testcase_12 AC 141 ms
29,720 KB
testcase_13 AC 143 ms
29,740 KB
testcase_14 AC 143 ms
29,560 KB
testcase_15 AC 140 ms
29,736 KB
testcase_16 AC 143 ms
29,784 KB
testcase_17 AC 141 ms
29,952 KB
testcase_18 AC 140 ms
29,640 KB
testcase_19 AC 142 ms
29,916 KB
testcase_20 AC 141 ms
29,808 KB
testcase_21 AC 141 ms
29,780 KB
testcase_22 AC 141 ms
29,808 KB
testcase_23 AC 140 ms
29,916 KB
testcase_24 AC 139 ms
29,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
from numpy.fft import rfft,irfft

def convolve(a1,a2):
    n = 2**(len(a1)+len(a2)+1).bit_length()
    b1,b2=np.zeros(n),np.zeros(n)
    b1[:len(a1)], b2[:len(a2)]= a1,a2
    return (irfft(rfft(b1)*rfft(b2))+0.5).astype(int)
  
n=int(input())

f = np.ones(n+1)
for i in range(3):
  f = convolve(f,f)
  
print(f[6*n])
0