結果

問題 No.786 京都大学の過去問
ユーザー akitsugu777akitsugu777
提出日時 2019-07-11 17:34:14
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 10,668 KB
実行使用メモリ 8,024 KB
最終ジャッジ日時 2023-08-07 19:01:38
合計ジャッジ時間 851 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

import math

n = int(input())

l = [[i, j] for i in range(n) for j in range(n) if i + 2*j == n]

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

x = 0
for i, j in l:
    x += c((i+j), i)

print(x + 1)
0