View Code of Problem 32

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;


 
public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while(scanner.hasNext()) {
			int t_x = scanner.nextInt();
			int t_y = scanner.nextInt();
			List<Person> list = new ArrayList<Person>();
			for(int i=0; i<5; i++) {
				int x = scanner.nextInt();
				int y = scanner.nextInt();
				double t = Math.pow(x-t_x, 2)+Math.pow(y-t_y, 2);
				double d = Math.sqrt(t);
				int hp = scanner.nextInt();
				list.add(new Person(x,y,hp,d));
			}
			int L = scanner.nextInt();
			double R = scanner.nextDouble();
			Boolean flag = false;
			
			for(int i=0; i<list.size(); i++) {
				Person p = list.get(i);
				
				if(p.t>(double)L) {
					continue;
				}
				double shang = p.t * R;
				if(shang > p.hp) {
					flag = true;
					for(int j=0; j<list.size(); j++) {
						Person po = list.get(j);
						if(i!=j && (p.x-t_x)*(po.y-t_y)==(po.x-t_x)*(p.y-t_y)&& po.t<p.t && po.t *R<po.hp) {
							flag = false;
						}
					}
					if(flag) {
						break;
					}
				}
			}
			if(flag) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		}
			
		}
	}

class Person {
	int x;
	int y;
	int hp;
	double t;
	public Person(int x, int y, int hp,double t) {
		super();
		this.x = x;
		this.y = y;
		this.hp = hp;
		this.t = t;
	}
	
}

Double click to view unformatted code.


Back to problem 32