시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 2 | 2 | 2 | 100.000% |
In 1948 Claude E.~Shannon in "The Mathematical Theory of Communication" has introduced his famous formula for the entropy of a discrete set of probabilities $p_1, \ldots, p_n$: $$H = - \sum p_i \log_2 p_i \; .$$
We will apply this formula to an arbitrary text string by letting $p_i$ be the relative frequencies of occurrence of characters in the string. For example, the entropy of the string "Northeastern European Regional Contest" with the length of 38 characters (including 3 spaces) is $3.883$ with 3 digits after decimal point. The following table shows relative frequencies and the corresponding summands for the entropy of this string.
char | occurs | $p_i$ | $-p_i \log_2 p_i$ | char | occurs | $p_i$ | $-p_i \log_2 p_i$ |
---|---|---|---|---|---|---|---|
space | 3 | 0.079 | 0.289 | i | 1 | 0.026 | 0.138 |
C | 1 | 0.026 | 0.138 | l | 1 | 0.026 | 0.138 |
E | 1 | 0.026 | 0.138 | n | 4 | 0.105 | 0.342 |
N | 1 | 0.026 | 0.138 | o | 4 | 0.105 | 0.342 |
R | 1 | 0.026 | 0.138 | p | 1 | 0.026 | 0.138 |
a | 3 | 0.079 | 0.289 | r | 3 | 0.079 | 0.289 |
e | 5 | 0.132 | 0.385 | s | 2 | 0.053 | 0.224 |
g | 1 | 0.026 | 0.138 | t | 4 | 0.105 | 0.342 |
h | 1 | 0.026 | 0.138 | u | 1 | 0.026 | 0.138 |
Your task is to find a string with the given entropy.
Input file consists of a single real number $H$ ($0.00 \le H \le 6.00$) with 2 digits after decimal point.
Write to the output file a line with a single string of at least one and up to 1000 characters '0'--'9', 'a'--'z', 'A'--'Z', '.' (dot), and spaces. This string must have the entropy within $0.005$ of $H$.
3.88
Northeastern European Regional Contest
ICPC > Regionals > Northern Eurasia > Northern Eurasia Finals > NEERC 2003 E번