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++) {
				list.add(new Person(scanner.nextInt(),scanner.nextInt(),scanner.nextInt()));
			}
			int L = scanner.nextInt();
			double R = scanner.nextDouble();
			Boolean flag = false;
			
			for(Person p : list) {
				double t = Math.pow(p.x-t_x, 2)+Math.pow(p.y-t_y, 2);
				double d = Math.sqrt(t);
				if(d>(double)L) {
					continue;
				}
				double shang = d * R;
				if(shang > p.hp) {
					flag = true;
					break;
				}
			}
			if(flag) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		}
			
		}
	}

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

Double click to view unformatted code.


Back to problem 32