fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int start = 3; // what pitcher are you starting with, 1-5
  13. String[] teams = {"Cubs", "Bears", "Blackhawks", "Sox", "Giants", "As", "Orioles", "Reds", "Astros"};
  14. List<int[]> games = new ArrayList<int[]>();
  15. // enter pitcher ratings without the decimal point
  16. int[] g1 = {335, 322, 344, 435, 329};
  17. games.add(g1);
  18. int[] g2 = {452, 435, 360, 332, 324};
  19. games.add(g2);
  20. int[] g3 = {456, 322, 311, 401, 299};
  21. games.add(g3);
  22. int[] g4 = {423, 338, 311, 319, 308};
  23. games.add(g4);
  24. int[] g5 = {445, 303, 327, 302, 412};
  25. games.add(g5);
  26. int[] g6 = {297, 303, 327, 289, 320};
  27. games.add(g6);
  28. int[] g7 = {596, 589, 502, 543, 422};
  29. games.add(g7);
  30. int[] g8 = {467, 312, 437, 327, 324};
  31. games.add(g8);
  32. int[] g9 = {439, 378, 324, 321, 317};
  33. games.add(g9);
  34.  
  35. int low = 102948;
  36. for (int a = 0; a < 9; a++) {
  37. for (int b = 0; b < 9; b++) {
  38. if (a == b) { continue; }
  39. for (int c = 0; c < 9; c++) {
  40. if (a == c || b == c) { continue; }
  41. for (int d = 0; d < 9; d++) {
  42. if (a == d || b == d || c == d) { continue; }
  43. for (int e = 0; e < 9; e++) {
  44. if (a == e || b == e || c == e || d == e) { continue; }
  45. for (int f = 0; f < 9; f++) {
  46. if (a == f || b == f || c == f || d == f || e == f) { continue; }
  47. for (int g = 0; g < 9; g++) {
  48. if (a == g || b == g || c == g || d == g || e == g || f == g) { continue; }
  49. for (int h = 0; h < 9; h++) {
  50. if (a == h || b == h || c == h || d == h || e == h || f == h || g == h) { continue; }
  51. for (int i = 0; i < 9; i++) {
  52. if (a == i || b == i || c == i || d == i || e == i || f == i || g == i || h == i) { continue; }
  53. int t = games.get(a)[start - 1];
  54. t += games.get(b)[start % 5];
  55. t += games.get(c)[(start + 1) % 5];
  56. t += games.get(d)[(start + 2) % 5];
  57. t += games.get(e)[(start + 3) % 5];
  58. t += games.get(f)[(start + 4) % 5];
  59. t += games.get(g)[(start + 5) % 5];
  60. t += games.get(h)[(start + 6) % 5];
  61. t += games.get(i)[(start + 7) % 5];
  62. if (t < low) {
  63. low = t;
  64. System.out.println(low + ": " + teams[a] + " " + teams[b] + " " + teams[c] + " " + teams[d] + " " + teams[e] + " " + teams[f] + " " + teams[g] + " " + teams[h] + " " + teams[i]);
  65. }
  66. }
  67. }
  68. }
  69. }
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. }
Success #stdin #stdout 0.22s 381184KB
stdin
Standard input is empty
stdout
3334: Cubs Bears Blackhawks Sox Giants As Orioles Reds Astros
3216: Cubs Bears Blackhawks Sox Giants As Reds Orioles Astros
3144: Cubs Bears Blackhawks Sox Giants Orioles Reds Astros As
3071: Cubs Bears Blackhawks Sox Giants Astros Reds Orioles As
3055: Cubs Bears Blackhawks Sox Reds Astros Giants Orioles As
2986: Bears Sox Blackhawks Cubs Giants Astros Reds Orioles As
2970: Bears Sox Blackhawks Cubs Reds Astros Giants Orioles As
2959: Bears Giants Blackhawks Cubs Reds Sox Astros Orioles As
2943: Blackhawks Bears Sox Cubs Reds Astros Giants Orioles As
2939: Blackhawks Bears Orioles Cubs Reds Sox Giants Astros As
2935: Blackhawks Giants Bears Cubs Reds Sox Astros Orioles As
2934: Sox Bears Blackhawks Cubs Reds Astros Giants Orioles As