Several years ago I was playing Spider Solitaire on my computer all the time. Sometimes I won, sometimes I lost. Then I stopped playing Spider Solitaire
and started participating in programming competitions. After a few years I happened to start my old solitaire program again. I was pleased to discover
that with the skill I gained during the years I am now able to win each and every game of Spider Solitaire.
However, the program still remembers some of my previous games and thus the statistics don't necessarily reflect my current perfect skills.
The program displays the statistics in the following way:
Games played: X
Games won: Y (Z %)
The number Z is the percentage of games I won, rounded down to the nearest integer. For example, if X=53 and Y=47, then Z=88.
(The value Y/X is roughly equal to 0.8868, which means that I won roughly 88.68% of the games I played. 88.68% rounded down to an integer is 88%.)
You will be given two ints played and won - the number of games I played so far, and the number
of games I won so far. Return the smallest positive integer G such that if I now win G games in a row the displayed value of Z will increase.
If this is impossible, return -1 instead.
|