結果

問題 No.352 カード並べ
ユーザー roarisroaris
提出日時 2022-10-08 20:49:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 286 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 87,264 KB
実行使用メモリ 76,004 KB
最終ジャッジ日時 2023-09-05 02:20:47
合計ジャッジ時間 1,919 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,040 KB
testcase_01 AC 70 ms
71,052 KB
testcase_02 AC 71 ms
71,084 KB
testcase_03 AC 69 ms
71,236 KB
testcase_04 AC 70 ms
71,060 KB
testcase_05 AC 70 ms
71,296 KB
testcase_06 AC 70 ms
71,332 KB
testcase_07 AC 73 ms
71,048 KB
testcase_08 AC 78 ms
76,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
fact = [1]

for i in range(1, N+1):
    fact.append(fact[-1]*i)

ans = 0

for x in range(2, N+1):
    ans += 2/x
    
    for y in range(1, x):
        for z in range(y+1, x):
            prob = (x-2)*fact[x-3]/fact[x]
            ans += 2*prob*y*z

ans += 1
print(ans)
0