結果
| 問題 |
No.301 サイコロで確率問題 (1)
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2022-11-03 00:54:07 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 737 bytes |
| コンパイル時間 | 185 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-07-17 12:30:37 |
| 合計ジャッジ時間 | 3,738 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 TLE * 1 |
ソースコード
import sys
input = sys.stdin.readline
def solve(x):
OK=0
NG=1<<60
while NG>OK+10**(-6):
mid=(OK+NG)/2
DP=[0]*x
for i in range(x-1,-1,-1):
score=6
for j in range(1,7):
if i+j==x:
score+=0
elif i+j>x:
score+=mid
else:
score+=DP[i+j]
if i!=0:
DP[i]=score/6
else:
if score/6>mid:
OK=mid
else:
NG=mid
return OK
t=int(input())
for tests in range(t):
N=int(input())
if N<=200:
print(solve(N))
else:
print(N+5/3)
titia