Rezultati

Up. imeNalogaJezikRezultatČas oddaje
avokado-2018 Fruit Ninja Java 0/100Napačen odgovor (WA) 13. okt '18 @ 14:31

Test Točke Porabljen spomin Porabljen čas Status
#1 11/11 36,871 MiB 0,000 s OK
#2 11/11 36,316 MiB 0,000 s OK
#3 11/11 36,680 MiB 0,000 s OK
#4 11/11 36,781 MiB 0,000 s OK
#5 11/11 40,320 MiB 0,000 s OK
#6 11/11 40,926 MiB 0,000 s OK
#7 11/11 37,496 MiB 0,000 s OK
#8 11/11 38,180 MiB 0,000 s OK
#9 0/12 37,570 MiB 0,000 s Napačen odgovor
Tvoj izhod:
​580
<<<EOF>>>
Pravilen izhod:
​638
<<<EOF>>>

Ocenjevani program (resitev5.java):
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class resitev5 {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String first = br.readLine();

		String[] splt = first.split(" ");
		
		int xa = Integer.parseInt(splt[0]);
		int ya = Integer.parseInt(splt[1]);
		int xb = Integer.parseInt(splt[2]);
		int yb = Integer.parseInt(splt[3]);
		
		String st = br.readLine();

		int sty = Integer.parseInt(st);
		
		int xk, yk, rk;
		int counterTilenov = 0;

		for (int i = 0; i < sty; i++) {
			first = br.readLine();
			String[] tmp = first.split(" ");
			xk = Integer.parseInt(tmp[0]);
			yk = Integer.parseInt(tmp[1]);
			rk = Integer.parseInt(tmp[2]);
			
			double a = yb-ya;
			double b = xa-xb;
			
			double c = -a*xa-b*ya;
			double razdaljaSredisce = Math.abs(a*xk + b*yk + c) / Math.sqrt(a*a + b*b);
//			System.out.println(razdaljaSredisce);
//			System.out.println(rk);
			if (razdaljaSredisce <= rk) {
				double raz1 = Math.sqrt(Math.pow((xk-xa), 2) + Math.pow((yk-ya), 2));
				double raz2 = Math.sqrt(Math.pow((xk-xb), 2) + Math.pow((yk-yb), 2));
				double razab = Math.sqrt(Math.pow((xa-xb), 2) + Math.pow((ya-yb), 2));
				if (razab >= raz1 && razab >= raz2) {
					counterTilenov++;
//					System.out.println(i + "pogoj1");
					continue;
				}
				if (rk >= raz1 || rk >= raz2) {
					counterTilenov++;
//					System.out.println(i);
					
					continue;
				}

			}
			
		}
		System.out.println(counterTilenov);
	}
}