Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. import java.util.*;
  2. import java.io.*;
  3. import java.math.*;
  4.  
  5. /**
  6. * Auto-generated code below aims at helping you parse
  7. * the standard input according to the problem statement.
  8. **/
  9. class Player {
  10.  
  11. public static void main(String args[]) {
  12. Scanner in = new Scanner(System.in);
  13. int tankX = 0;
  14. int tankY = 0;
  15. int policeX = 0;
  16. int policeY = 0;
  17. int wragX = 0;
  18. int wragY = 0;
  19. int carX = 0;
  20. int carY = 0;
  21. double minS = 1000000;
  22. double minPoliceS = 1000000;
  23. int flash = 300;
  24.  
  25. // game loop
  26. while (true) {
  27. int myScore = in.nextInt();
  28. int enemyScore1 = in.nextInt();
  29. int enemyScore2 = in.nextInt();
  30. int myRage = in.nextInt();
  31. int enemyRage1 = in.nextInt();
  32. int enemyRage2 = in.nextInt();
  33. int unitCount = in.nextInt();
  34. for (int i = 0; i < unitCount; i++) {
  35. int unitId = in.nextInt();
  36. int unitType = in.nextInt();
  37. int player = in.nextInt();
  38. float mass = in.nextFloat();
  39. int radius = in.nextInt();
  40. int x = in.nextInt();
  41. int y = in.nextInt();
  42. int vx = in.nextInt();
  43. int vy = in.nextInt();
  44. int extra = in.nextInt();
  45. int extra2 = in.nextInt();
  46. System.err.println(unitType);
  47. if (unitType == 0 && player == 0) {
  48. carX = x;
  49. carY = y;
  50. }
  51. if (unitType == 4) {
  52. wragX = x;
  53. wragY = y;
  54. }
  55. if (unitType == 1 && player == 1) {
  56. tankX = x;
  57. tankY = y;
  58. }
  59. if (unitType == 3 && player == 3) {
  60. policeX = x;
  61. policeY = y;
  62. }
  63.  
  64. double dist1 = StrictMath.hypot(x - policeX, y - policeY) ;
  65. if (dist1 < minPoliceS) {
  66. minPoliceS = dist1;
  67. policeX = x;
  68. policeY = y;
  69. }
  70. double dist = StrictMath.hypot(x - wragX, y - wragY) ;
  71. if (dist < minS) {
  72. minS = dist;
  73. wragX = x;
  74. wragY = y;
  75. }
  76.  
  77. }
  78.  
  79. if (minS < 1000) {
  80. flash = 200;
  81. } else {
  82. flash = 300;
  83. }
  84.  
  85. // Write an action using
  86.  
  87.  
  88. //To debug: System.err.println("Debug messages...");
  89.  
  90. System.out.println(wragX + " " + wragY + " " + flash);
  91. System.out.println(policeX + " " + policeY + " " + flash);
  92. System.out.println("WAIT");
  93. }
  94. }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement