結果
| 問題 |
No.76 回数の期待値で練習
|
| コンテスト | |
| ユーザー |
buey_t
|
| 提出日時 | 2023-03-17 16:48:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,698 bytes |
| コンパイル時間 | 314 ms |
| コンパイル使用メモリ | 82,560 KB |
| 実行使用メモリ | 280,044 KB |
| 最終ジャッジ日時 | 2024-09-18 10:03:16 |
| 合計ジャッジ時間 | 2,135 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 2 |
ソースコード
def main():
try:
import pypyjit
pypyjit.set_param('max_unroll_recursion=-1')
except:
pass
try:
import sys
sys.setrecursionlimit(10**7)
except:
pass
from math import sqrt,sin,cos,tan,ceil,radians,floor,gcd,exp,log,log10,log2,factorial,fsum
from heapq import heapify, heappop, heappush
from bisect import bisect_left, bisect_right
from copy import deepcopy
import copy
import random
from collections import deque,Counter,defaultdict
from itertools import permutations,combinations
from decimal import Decimal,ROUND_HALF_UP
#tmp = Decimal(mid).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
from functools import lru_cache, reduce
#@lru_cache(maxsize=None)
from operator import add,sub,mul,xor,and_,or_,itemgetter
INF = 10**18
mod1 = 10**9+7
mod2 = 998244353
#DecimalならPython
'''
クエリO(1)にしよう
確率等しいとは限らないのやばすぎだろ
あーーーーーー
推測させるのかw
なるほど
2個めはそのままp1の確率
'''
p = [12,6,4,12,3,6]
for _ in range(int(input())):
N = int(input())
dp = [0]*(N+10)
for i in reversed(range(N)):
dp[i] = 1 + dp[i+1]/p[1-1] + dp[i+2]/p[2-1] + dp[i+3]/p[3-1] + dp[i+4]/p[4-1] + dp[5+1]/p[5-1] + dp[i+6]/p[6-1]
print(dp[0])
if __name__ == '__main__':
main()
buey_t