結果
問題 |
No.574 正多面体サイコロ
|
ユーザー |
![]() |
提出日時 | 2021-05-04 17:39:09 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 176 ms / 2,000 ms |
コード長 | 851 bytes |
コンパイル時間 | 248 ms |
コンパイル使用メモリ | 82,468 KB |
実行使用メモリ | 77,144 KB |
最終ジャッジ日時 | 2024-07-23 12:55:11 |
合計ジャッジ時間 | 2,689 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) F,N,K = MI() fac = [1] for i in range(1,N+1): fac.append(fac[-1]*i) ans = 0 for x in range(1,F+1): e = 0 p = (x-1)/F q = (F-x)/F r = 1/F for i in range(N-K+1): # x-1以下の個数 for j in range(K): # x+1以上の個数 k = N-(i+j) # xの個数 e += (fac[N]//fac[i]//fac[j]//fac[k])*pow(p,i)*pow(q,j)*pow(r,k) ans += x*e print(ans)