結果
| 問題 |
No.567 コンプリート
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-02-04 02:21:57 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 948 bytes |
| コンパイル時間 | 3,560 ms |
| コンパイル使用メモリ | 181,292 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-01 11:19:56 |
| 合計ジャッジ時間 | 4,312 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 12 |
ソースコード
import sequtils
# import algorithm,math,tables
# import sets,intsets,queues,heapqueue,bitops,strutils
# import strutils,strformat,sugar,macros,times
# template stopwatch(body) = (let t1 = cpuTime();body;echo "TIME:",(cpuTime() - t1) * 1000,"ms")
# template `^`(n:int) : int = (1 shl n)
template times*(n:int,body) = (for _ in 0..<n: body)
template `max=`*(x,y) = x = max(x,y)
template `min=`*(x,y) = x = min(x,y)
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
while true:
let k = getchar_unlocked()
if k < '0': return
result = 10 * result + k.ord - '0'.ord
# 揃った数が1~6個の確率 x n
const dp = (proc (n:int):seq[float] =
var dp = newSeqWith(n+1,newSeq[float](7))
dp[1][1] = 1.0
for i in 2..n:
for j in 1..6:
dp[i][j] = dp[i-1][j-1] * (7.0 - j.float) / 6.0 + dp[i-1][j] * j.float / 6.0
return dp.mapIt(it[6])
)(10_0001)
echo dp[scan().min(10_0000)]