面白い問題おしえて〜 ..
128:132人目の素数さん
18/11/07 00:32:00.28 p6NUZQ5G.net
>>105
分数表示したいのでPythonに移植した。
from fractions import Fraction
def dice126(N):
P=list()
for n in range(6):
P.append(1)
P.append(1-1/(6**6))
for n in range(7,N+1):
P.append(P[n-1]-P[n-6]/(6**6))
return(1-P[N])
def dice123456(N):
print(Fraction(dice126(N)))
print(" = " + str(dice126(N)))
dice123456(1000)
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
1926日前に更新/466 KB
担当:undef