Note that there are some explanatory texts on larger screens.

plurals
  1. POFacebook Hacker Cup Subround 1B - Slot Machine Hacker
    primarykey
    data
    text
    <p>Source: Facebook Hacker Cup.</p> <p>I've tried generating a few lists of return values from the function below but can't seem to find what makes it possible to predict future random numbers. How would I go about solving a problem like this one?</p> <p><strong>Slot Machine Hacker</strong></p> <p>You recently befriended a guy who writes software for slot machines. After hanging out with him a bit, you notice that he has a penchant for showing off his knowledge of how the slot machines work. Eventually you get him to describe for you in precise detail the algorithm used on a particular brand of machine. The algorithm is as follows:</p> <pre> int getRandomNumber() { secret = (secret * 5402147 + 54321) % 10000001; return secret % 1000; } </pre> <p>This function returns an integer number in [0, 999]; each digit represents one of ten symbols that appear on a wheel during a particular machine state.secret is initially set to some nonnegative value unknown to you.</p> <p>By observing the operation of a machine long enough, you can determine value of secret and thus predict future outcomes. Knowing future outcomes you would be able to bet in a smart way and win lots of money.</p> <p>Input The first line of the input contains positive number T, the number of test cases. This is followed by T test cases. Each test case consists of a positive integer N, the number of observations you make. Next N tokens are integers from 0 to 999 describing your observations. Output For each test case, output the next 10 values that would be displayed by the machine separated by whitespace. If the sequence you observed cannot be produced by the machine your friend described to you, print “Wrong machine” instead. If you cannot uniquely determine the next 10 values, print “Not enough observations” instead.</p> <p>Constraints T = 20 1 ≤ N ≤ 100 Tokens in the input are no more than 3 characters long and contain only digits 0-9.</p> <p>sample input</p> <pre>5 1 968 3 767 308 284 5 78 880 53 698 235 7 23 786 292 615 259 635 540 9 862 452 303 558 767 105 911 846 462 </pre> <p>sample output</p> <pre> Not enough observations 577 428 402 291 252 544 735 545 771 34 762 18 98 703 456 676 621 291 488 332 38 802 434 531 725 594 86 921 607 35 Wrong machine </pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload