编程介的小学生 2017-10-07 14:31 采纳率: 20.5%
浏览 754
已采纳

Roulette

Description

The political Party needs some money to lead its campaign. PSOS have insufficient funds in this time, so they want to earn some money. One of the new members have designed a completely Electronic Roulette in Monte Carlo some time ago. During the obligatory Learn-How-to-Say-the-Truth Course, the member said that the random number generator follows the equation:

xk+1 = (A * xk) mod 47

in which xk+1 is the random number following the previous number xk, and A is the Constant of the Day that is determined by the director Karl Monte each morning. PSOS sent several members to Monte Carlo immediately, to get some money. The problem is that the author of the algorithm suddenly died during the Course. PSOS now need somebody who is able to break the algorithm and predict pseudo-random numbers. Given the succession

xt-n, xt-n+1, ..., xt-1, xt

the program should be able to decide, what the next number xt+1 will be. The Constant A is always integer, non-negative, and less then 1000000. All the numbers xi are integer and non-negative.
Input

At the first line there is a positive integer N stating the number of assignments to follow. Each assignment consists of exactly two lines. There is an integer non-negative number M at the first line of each assignment. The next line contains the succession of exactly M numbers (x1, x2, ... xM) separated by spaces.
Output

Output a single line for each assignment. If it is possible to determine the next number in the succession, the line must contain the sentence "Vsad na X." (Bet on X). Replace X with the number which will follow in the succession. If it is not possible to determine the following number, output the sentence "Dalsi cislo nelze urcit." (It is not possible to determine the next number). If the given succession does not follow the above equation, output the sentence "Algoritmus byl zmenen." (The algorithm was changed).
Sample Input

3
1
5
3
7 33 28
3
25 26 25
Sample Output

Dalsi cislo nelze urcit.
Vsad na 38.
Algoritmus byl zmenen.

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?