結果

問題 No.574 正多面体サイコロ
ユーザー itai_dabokuitai_daboku
提出日時 2019-08-07 00:32:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 8,084 KB
最終ジャッジ日時 2023-09-25 18:16:57
合計ジャッジ時間 1,531 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,084 KB
testcase_01 AC 19 ms
7,912 KB
testcase_02 AC 17 ms
8,064 KB
testcase_03 AC 17 ms
7,992 KB
testcase_04 AC 16 ms
7,964 KB
testcase_05 AC 17 ms
8,032 KB
testcase_06 AC 17 ms
7,964 KB
testcase_07 AC 16 ms
7,936 KB
testcase_08 AC 17 ms
7,904 KB
testcase_09 AC 19 ms
7,908 KB
testcase_10 AC 17 ms
7,900 KB
testcase_11 AC 17 ms
8,048 KB
testcase_12 AC 17 ms
7,988 KB
testcase_13 AC 17 ms
7,996 KB
testcase_14 AC 16 ms
7,980 KB
testcase_15 AC 17 ms
7,996 KB
testcase_16 AC 17 ms
7,968 KB
testcase_17 AC 17 ms
7,940 KB
testcase_18 AC 17 ms
7,940 KB
testcase_19 AC 17 ms
8,068 KB
testcase_20 AC 16 ms
7,908 KB
testcase_21 AC 16 ms
7,960 KB
testcase_22 AC 20 ms
8,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import factorial
def comb(n,r):
    return factorial(n)/factorial(r)/factorial(n-r)

f,n,k=map(int,input().split())
ex=0
ls=[]
for i in range(f):
  ff=0
  p_i=(i+1)/f
  for j in range(n-k+1,n+1):
    ff+=comb(n,j)*(p_i**j)*((1-p_i)**(n-j))
  ls.append(ff)

p=[ls[i+1]-ls[i] for i in range(f-1)]
p.insert(0,ls[0])

for i in range(f):
  ex+=(i+1)*p[i]
print(ex)
0