UVa 408

From Algorithmist
Jump to navigation Jump to search

408 - Uniform Generator[edit]

Summary[edit]

Figure out if a given number and seed are uniformly distributed.

Explanation[edit]

  • While you do not run into a duplicate value keep checking the loop and figure out whether or not you get all the numbers from 0 to mod.
  • Keep track of this in some type of data structure and do a retrieval when necessary.

Gotchas[edit]

  • You will run out of the allocated space if you do not decide your datastructure carefully.

Implementations[edit]

  • C++ vector<bool> allows for storing the status of the 10^5 ints into 10^5 bits.


Input[edit]

3 5
15 20
63923 99999

Output[edit]

         3         5    Good Choice

        15        20    Bad Choice

     63923     99999    Good Choice

Solutions[edit]

References[edit]