Logo
(追記) (追記ここまで)

22624번 - Strange String Manipulation 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
8 초 (추가 시간 없음) 512 MB54232044.444%

문제

A linear congruential generator produces a series $R(·)$ of pseudo-random numbers by the following formulas:

$R(0) = S,ドル $R(i) = (A · R(i - 1) + C) \bmod M$ (for $i = 1, 2, \dots$),

where $S,ドル $A,ドル $C,ドル and $M$ are all parameters. In this problem, 0ドル \le S, A, C \le 15$ and $M = 256$.

Now suppose we have some input string $I(·),ドル where each character in the string is an integer between 0ドル$ and $(M - 1)$. Then, using the pseudo-random number series $R(·),ドル we obtain another string $O(·)$ as the output by the following formula:

$O(i) = (I(i) + R(i)) \bmod M$ (for $i = 1, 2, \dots$),

Your task is to write a program that shows the parameters $S,ドル $A,ドル and $C$ such that the information entropy of the output string $O(·)$ is minimized. Here, the information entropy $H$ is given by the following formula:

$$H = -\sum_{x}{\frac{\text{#}(x)}{N}\log{\frac{\text{#}(x)}{N}} }$$

where $N$ is the length of the string and $\text{#}(x)$ is the number of occurences of the alphabet $x$.

입력

The input has the following format:

$N$

$I(1) I(2) \dots I(N)$

$N$ does not exceed 256.

출력

Print in a line the values of the three parameters $S,ドル $A,ドル and $C$ separated by a single space. If more than one solution gives the same minimum entropy, choose the solution with the smallest $S,ドル $A,ドル and then $C$.

제한

예제 입력 1

5
5 4 3 2 1

예제 출력 1

0 1 1

예제 입력 2

5
7 7 7 7 7

예제 출력 2

0 0 0

예제 입력 3

10
186 8 42 24 154 40 10 56 122 72

예제 출력 3

8 7 14

힌트

출처

Contest > ICPC Japanese Alumni Group > JAG Summer Camp > JAG Summer Camp 2009 Day 3 A번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /