結果

問題 No.786 京都大学の過去問
ユーザー MineMine
提出日時 2020-09-09 16:21:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 276 bytes
コンパイル時間 572 ms
コンパイル使用メモリ 10,532 KB
実行使用メモリ 7,988 KB
最終ジャッジ日時 2023-08-21 18:35:49
合計ジャッジ時間 1,153 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,984 KB
testcase_01 AC 16 ms
7,988 KB
testcase_02 AC 16 ms
7,852 KB
testcase_03 AC 15 ms
7,864 KB
testcase_04 AC 16 ms
7,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = int(input())
ans = 0
for i in range(n):
    one = n-2*i
    two = i
    if one < 0:
        break
    ans += combinations_count(one+two, one)

print(ans)
0