当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3473:Stochastic Finite State Automaton

Special Judge 特殊评判
题目描述

The finite state automaton (FSA) is an important model of behavioral investigations in computer science, linguistics as well as many other different areas of study. In theoretical computer science literature, an FSA is typically modeled as a string pattern recognizer described with a quintuple <Σ, S, s0, δ, F>, where:

  • Σ is the input alphabet (a finite nonempty set of symbols).
  • S is a finite nonempty set of states.
  • s0 is an element in S designated as the initial state.
  • δ is a function δ : S × Σ → S known as the transition function.
  • F is a (possibly empty) subset of S whose elements are designated as the final states.

An FSA with the above description operates as follows:

  • At the beginning, the automaton starts in the initial state s0.
  • The automaton continuously reads symbols from its input, one symbol at a time, and transits between states according to the transition function δ. To be specific, let s be the current state and w the symbol just read, the automaton transits to the state given by δ(s, w).
  • When the automaton reaches the end of the input, if the current state belongs to F, the string consisting sequentially of the symbols read by the automaton is declared accepted, otherwise it is declared rejected.

We will not delve into further details concerning the FSA but focus on a slightly simplified variant – the stochastic finite state automaton (SFSA). An SFSA is described with a duple <A, b>, where:

  • A is an n-by-n nonnegative square matrix.
  • b is an n-dimensional nonnegative column vector.

The automaton assumes the first n positive integers as its states. Unlike a normal FSA, it does not read any symbols and consequently does not have an input alphabet. And its transitions are completely self-determined. Concretely speaking, an SFSA operates as follows:

  • At the beginning, the automaton selects randomly a positive integer not exceeding n, i, as the initial state with probability bi, the i-th component of b. (It is required that the components of b sum to exactly 1.)
  • At any stage before the automation halts, let j be the current state, the automaton selects randomly a positive integer not exceeding n, i, with probability aij, the element of A located in the i-th row and the j-th column, or 0 with probability __poj_jax_start__\textstyle 1-\sum_{i=1}^na_{ij}__poj_jax_end__. If the automaton selects 0, it halts immediately, otherwise it transits to state i. (It is required that the sum of elements of every column of A be not less than or equal to 1.)

Deriving from the above description, we can draw several implications concerning the SFSA. For instance, observably, the automaton may make an infinite number of transits and never halt, but intuitively, this is very unlikely to occur. Before scrutinizing the behavioral features of the SFSA, it is advisable to first investigate its statistical characteristics, namely, we want to know for each state i, the probability that the automaton decides to halt in that state and, given that automaton halts in that state, the expectation as well as the standard deviation of the number of transitions that have been made.

输入解释

The input consists of a single test case. The first input line contains the number n (1 ≤ n ≤ 200) alone. The next n lines each contain n nonnegative numbers, giving the elements of an n-by-n square matrix A in row-major order. On the last line, there are n nonnegative numbers which are the components of an n-dimensional column vector b in increasing order of their indices. The sum of elements in every column of A is strictly less than 1, and the components of b sum to exactly 1. The duple <A, b> constitutes the description of an SFSA.

输出解释

For each state in increasing order of their numerical values, output in order and as accurate as possibly the probability that the automaton decides to halt in that state and, given that automaton halts in that state, the expectation as well as the standard deviation of the number of transitions that have been made. A special checker program that admits an relative error of 10−6 is used to verify the output.

输入样例
3
0.25 0 0
0.25 0 0
0.25 0 0
1 0 0
输出样例
0.33333333 0.33333333 0.66666667
0.33333333 1.33333333 0.66666667
0.33333333 1.33333333 0.66666667
提示

For a random variable X, Var(X) = E(X2) − (E(X))2.


该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3473

最后修改于 2020-10-29T07:02:30+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
4000 131072