fork download
  1. import java.io.*;
  2. import java.util.*;
  3. import java.math.*;
  4.  
  5. import static java.lang.Math.*;
  6. import static java.lang.Character.*;
  7. import static java.util.Arrays.*;
  8. import static java.util.Collections.*;
  9. import static java.math.BigInteger.*;
  10.  
  11. class A {
  12. static final char PROB = A.class.getSimpleName().charAt(0);
  13. static final boolean PRAC = false;
  14.  
  15. static final int INF = 1 << 20;
  16. static final int[] di = { -1, 0, 0, 1 };
  17. static final int[] dj = { 0, -1, 1, 0 };
  18. static Scanner sc = new Scanner(System.in);
  19.  
  20. final long N;
  21. final int PD, PG;
  22.  
  23. public A() {
  24. N = sc.nextLong();
  25. PD = sc.nextInt();
  26. PG = sc.nextInt();
  27. }
  28.  
  29. public String solve() {
  30. int gpd = gcd(100, PD);
  31. int D = 100 / gpd;
  32. int DD = PD / gpd;
  33. int gpg = gcd(100, PG);
  34. int G = 100 / gpg;
  35. int GG = PG / gpg;
  36.  
  37. if ((PG == 100 && PD < 100) || (PG == 0 && PD > 0) || D > N)
  38. return "Broken";
  39.  
  40. return "Possible";
  41. }
  42.  
  43. private int gcd(int x, int y) {
  44. return y == 0 ? x : gcd(y, x % y);
  45. }
  46.  
  47. public static void main(String... args) {
  48. // large();
  49. int T = Integer.parseInt(sc.nextLine());
  50. for (int t = 1; t <= T; t++) {
  51. System.err.printf("Case #%s%n", t);
  52. System.out.printf("Case #%s: %s%n", t, new A().solve());
  53. }
  54. System.err.println("done.");
  55. }
  56.  
  57. public static void small() {
  58. String in = PROB + "-small" + (PRAC ? "-practice" : "-attempt" + 0) + ".in";
  59. String out = PROB + "-small.out";
  60. try {
  61. if (!PRAC)
  62. for (int i = 1; new File(PROB + "-small" + "-attempt" + i + ".in").exists(); i++)
  63. in = PROB + "-small" + "-attempt" + i + ".in";
  64. System.setOut(new PrintStream(out));
  65. } catch (Exception e) {
  66. e.printStackTrace();
  67. System.exit(0);
  68. }
  69. sc = new Scanner(System.in);
  70. }
  71.  
  72. public static void large() {
  73. String in = PROB + "-large" + (PRAC ? "-practice" : "") + ".in";
  74. String out = PROB + "-large.out";
  75. try {
  76. System.setOut(new PrintStream(out));
  77. } catch (Exception e) {
  78. e.printStackTrace();
  79. System.exit(0);
  80. }
  81. sc = new Scanner(System.in);
  82. }
  83.  
  84. private static void debug(Object... os) {
  85. System.err.println(deepToString(os));
  86. }
  87. }
  88.  
Success #stdin #stdout 0.08s 213440KB
stdin
3
1 100 50
10 10 100
9 80 56
stdout
Case #1: Possible
Case #2: Broken
Case #3: Possible