結果

問題 No.287 場合の数
ユーザー tjaketjake
提出日時 2015-12-03 23:09:05
言語 Python2
(2.7.18)
結果
AC  
実行時間 94 ms / 5,000 ms
コード長 248 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-04-25 12:40:15
合計ジャッジ時間 2,399 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
6,272 KB
testcase_01 AC 12 ms
6,272 KB
testcase_02 AC 13 ms
6,400 KB
testcase_03 AC 94 ms
6,400 KB
testcase_04 AC 88 ms
6,400 KB
testcase_05 AC 69 ms
6,272 KB
testcase_06 AC 16 ms
6,272 KB
testcase_07 AC 38 ms
6,400 KB
testcase_08 AC 51 ms
6,400 KB
testcase_09 AC 69 ms
6,272 KB
testcase_10 AC 90 ms
6,400 KB
testcase_11 AC 30 ms
6,272 KB
testcase_12 AC 81 ms
6,272 KB
testcase_13 AC 21 ms
6,400 KB
testcase_14 AC 41 ms
6,400 KB
testcase_15 AC 68 ms
6,400 KB
testcase_16 AC 44 ms
6,400 KB
testcase_17 AC 80 ms
6,400 KB
testcase_18 AC 37 ms
6,400 KB
testcase_19 AC 73 ms
6,400 KB
testcase_20 AC 47 ms
6,400 KB
testcase_21 AC 70 ms
6,272 KB
testcase_22 AC 68 ms
6,400 KB
testcase_23 AC 59 ms
6,400 KB
testcase_24 AC 42 ms
6,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = input()
dp = [[-1]*(6*n+1) for i in xrange(8)]
def dfs(c, rest):
    if c<0: return rest==0
    v = dp[c][rest]
    if v != -1: return v
    r = dp[c][rest] = sum(dfs(c-1, rest-i) for i in xrange(min(n, rest)+1))
    return r
print dfs(7, 6*n)
0