Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 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. double dist = StrictMath.hypot(x - wragX, y - wragY) ;
  56. if (dist < minS) {
  57. minS = dist;
  58. wragX = x;
  59. wragY = y;
  60. }
  61.  
  62. if (unitType == 1 && player == 0 ) {
  63. policeX = x;
  64. policeY = y;
  65. }
  66.  
  67. double dist1 = StrictMath.hypot(x - policeX, y - policeY) ;
  68. if (dist1 < minPoliceS) {
  69. minPoliceS = dist1;
  70. policeX = x;
  71. policeY = y;
  72. }
  73.  
  74.  
  75. }
  76.  
  77. if (minS < 1000) {
  78. flash = 150;
  79. } else {
  80. flash = 300;
  81. }
  82.  
  83. // Write an action using
  84.  
  85.  
  86. //To debug: System.err.println("Debug messages...");
  87.  
  88. System.out.println(wragX + " " + wragY + " " + flash);
  89. System.out.println(policeX + " " + policeY + " " + flash);
  90. System.out.println("WAIT");
  91. }
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement