Ad
  • Custom User Avatar

    INPUT: an integer number n>=0

    But what is n? Number of sides? Friend's best score?

    Why in the example do you need to roll 1 thrice in order to win (or lose)? Doesn't the highest single number win?

    Please clarify some of these points, preferrably in description.

  • Custom User Avatar

    But he does not know the probabilities for finding a certain number m.

    Make this "But he does not know the probabilities for finding a certain number."

    There is no need to introduce a variable name here, let alone a new one that is then never used again.

  • Custom User Avatar

    the probability to get the number n is 1/2^n.

    INPUT: an integer number n>=0

    Don't give different variables identical names. ( An argument doesn't even need a specified name! )

  • Custom User Avatar
    Note: ./src/test/java/SwapTest.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.