結果

問題 No.287 場合の数
ユーザー tjaketjake
提出日時 2015-12-03 23:09:05
言語 Python2
(2.7.18)
結果
AC  
実行時間 88 ms / 5,000 ms
コード長 248 bytes
コンパイル時間 71 ms
コンパイル使用メモリ 6,496 KB
実行使用メモリ 6,248 KB
最終ジャッジ日時 2023-08-07 19:07:15
合計ジャッジ時間 2,408 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
6,248 KB
testcase_01 AC 11 ms
6,216 KB
testcase_02 AC 12 ms
6,116 KB
testcase_03 AC 88 ms
6,128 KB
testcase_04 AC 87 ms
6,008 KB
testcase_05 AC 66 ms
6,068 KB
testcase_06 AC 16 ms
5,972 KB
testcase_07 AC 36 ms
6,192 KB
testcase_08 AC 49 ms
5,996 KB
testcase_09 AC 67 ms
6,096 KB
testcase_10 AC 87 ms
6,192 KB
testcase_11 AC 29 ms
6,000 KB
testcase_12 AC 79 ms
6,128 KB
testcase_13 AC 20 ms
6,092 KB
testcase_14 AC 39 ms
6,104 KB
testcase_15 AC 64 ms
6,048 KB
testcase_16 AC 41 ms
6,088 KB
testcase_17 AC 76 ms
6,100 KB
testcase_18 AC 35 ms
6,104 KB
testcase_19 AC 71 ms
6,124 KB
testcase_20 AC 45 ms
6,052 KB
testcase_21 AC 66 ms
6,052 KB
testcase_22 AC 64 ms
6,020 KB
testcase_23 AC 55 ms
6,084 KB
testcase_24 AC 40 ms
6,240 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