結果

問題 No.44 DPなすごろく
ユーザー koyopro
提出日時 2015-09-20 11:40:29
言語 Python2
(2.7.18)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 344 bytes
コンパイル時間 39 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-19 08:20:15
合計ジャッジ時間 1,038 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

N, = map(int, raw_input().split())

max2 = N / 2


fact = [1]
for i in xrange(1, 100):
    fact.append(i * fact[i-1])

total = 0
for i in xrange(max2+1):
    # 2をi回使う場合の数を求めて足す
    num1 = (N - 2 * i) # 1の回数
    add = fact[num1 + i] / fact[i] / fact[num1]
    total += add

print total
0