Google Code Jam '11 Round 1A Problem A - FreeCell Statistics

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 60.0s
Memory limit: 1G

Problem types

I played D (D > 0) games of FreeCell today. Each game of FreeCell ends in one of two ways -- I either win, or I lose. I've been playing for many years, and have so far played G games in total (obviously, G \ge D).

At the end of the day, I look at the game statistics to see how well I have played. It turns out that I have won exactly P_D percent of the D games today, and exactly P_G percent of G total games I had ever played. Miraculously, there is no rounding necessary -- both percentages are exact! Unfortunately, I don't remember the exact number of games that I have played today (D), or the exact number of games that I have played in total (G). I do know that I could not have played more than N games today (D \le N).

Are the percentages displayed possible, or is the game statistics calculator broken?

Input Specification

The first line of the input gives the number of test cases, T. T lines follow. Each line contains 3 integers -- N, P_D and P_G.

Output Specification

For each test case, output one line containing Case #x: y, where x is the case number (starting from 1) and y is either Possible or Broken.

Limits

0 \le P_D \le 100;

0 \le P_G \le 100;

Memory limit: 1 GB.

Small Dataset

1 \le T \le 100;

1 \le N \le 10;

Time limit: 30 seconds.

Large Dataset

1 \le T \le 2000;

1 \le N \le 10^{15};

Time limit: 60 seconds.

Sample Input

3
1 100 50
10 10 100
9 80 56

Sample Output

Case #1: Possible
Case #2: Broken
Case #3: Possible

In Case #3, I could have played 5 games today (D = 5) and 25 games in total (G = 25), and won 4 games today (80\% \text{ of } 5) and 14 games in total (56\% \text{ of } 25).

Note

This problem has different time limits for different batches. If you exceed the Time Limit for any batch, the judge will incorrectly display >60.000s regardless of the actual time taken. Refer to the Limits section for batch-specific time limits.


Comments

There are no comments at the moment.