#P13365. [GCJ 2011 #1A] FreeCell Statistics

[GCJ 2011 #1A] FreeCell Statistics

题目描述

I played DD (D>0D > 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 GG games in total (obviously, GDG \geq 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 PDP_D percent of the DD games today, and exactly PGP_G percent of GG 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 (DD), or the exact number of games that I have played in total (GG). I do know that I could not have played more than NN games today (DND \leq N).

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

输入格式

The first line of the input gives the number of test cases, TT. TT lines follow. Each line contains 3 integers -- NN, PDP_D and PGP_G.

输出格式

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

3
1 100 50
10 10 100
9 80 56
Case #1: Possible
Case #2: Broken
Case #3: Possible

提示

Sample Explanation

In Case #3, I could have played 55 games today (D=5D = 5) and 2525 games in total (G=25G = 25), and won 44 games today (80%80\% of 55) and 1414 games in total (56%56\% of 2525).

Limits

  • 0PD1000 \leq P_D \leq 100;
  • 0PG1000 \leq P_G \leq 100.

Small dataset (6 Pts, Test set 1 - Visible)

  • 1T1001 \leq T \leq 100;
  • 1N101 \leq N \leq 10.
  • Time limit: 30 3 seconds.

Large dataset (14 Pts, Test set 2 - Hidden)

  • 1T20001 \leq T \leq 2000;
  • 1N10151 \leq N \leq 10^{15}.
  • Time limit: 60 6 seconds.