結果

問題 No.352 カード並べ
ユーザー rlangevinrlangevin
提出日時 2023-10-02 12:34:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 254 bytes
コンパイル時間 344 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 71,616 KB
最終ジャッジ日時 2023-10-02 12:34:35
合計ジャッジ時間 2,163 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,368 KB
testcase_01 AC 67 ms
71,224 KB
testcase_02 AC 72 ms
71,616 KB
testcase_03 AC 68 ms
71,440 KB
testcase_04 AC 70 ms
71,300 KB
testcase_05 AC 69 ms
71,372 KB
testcase_06 AC 70 ms
71,388 KB
testcase_07 AC 67 ms
71,436 KB
testcase_08 AC 70 ms
71,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
ans = 2
now = 0
fact = [1] * (N + 1)
for i in range(1, N + 1):
    fact[i] = fact[i - 1] * i

for i in range(3, N + 1):
    now += (i - 1)**2 * (i - 2)//2
    ans += (2 * fact[i - 1] + 2 * now * (i - 2) * fact[i - 3])/fact[i]

print(ans)
0