Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.io.*;
- import java.math.*;
- /**
- * Auto-generated code below aims at helping you parse
- * the standard input according to the problem statement.
- **/
- class Player {
- public static void main(String args[]) {
- Scanner in = new Scanner(System.in);
- int tankX = 0;
- int tankY = 0;
- int policeX = 0;
- int policeY = 0;
- int wragX = 0;
- int wragY = 0;
- int carX = 0;
- int carY = 0;
- double minS = 1000000;
- double minPoliceS = 1000000;
- int flash = 300;
- // game loop
- while (true) {
- int myScore = in.nextInt();
- int enemyScore1 = in.nextInt();
- int enemyScore2 = in.nextInt();
- int myRage = in.nextInt();
- int enemyRage1 = in.nextInt();
- int enemyRage2 = in.nextInt();
- int unitCount = in.nextInt();
- for (int i = 0; i < unitCount; i++) {
- int unitId = in.nextInt();
- int unitType = in.nextInt();
- int player = in.nextInt();
- float mass = in.nextFloat();
- int radius = in.nextInt();
- int x = in.nextInt();
- int y = in.nextInt();
- int vx = in.nextInt();
- int vy = in.nextInt();
- int extra = in.nextInt();
- int extra2 = in.nextInt();
- System.err.println(unitType);
- if (unitType == 0 && player == 0) {
- carX = x;
- carY = y;
- }
- if (unitType == 4) {
- wragX = x;
- wragY = y;
- }
- double dist = StrictMath.hypot(x - wragX, y - wragY) ;
- if (dist < minS) {
- minS = dist;
- wragX = x;
- wragY = y;
- }
- if (unitType == 1 && player == 0 ) {
- policeX = x;
- policeY = y;
- }
- double dist1 = StrictMath.hypot(x - policeX, y - policeY) ;
- if (dist1 < minPoliceS) {
- minPoliceS = dist1;
- policeX = x;
- policeY = y;
- }
- }
- if (minS < 1000) {
- flash = 150;
- } else {
- flash = 300;
- }
- // Write an action using
- //To debug: System.err.println("Debug messages...");
- System.out.println(wragX + " " + wragY + " " + flash);
- System.out.println(policeX + " " + policeY + " " + flash);
- System.out.println("WAIT");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement