Rezultati

Up. imeNalogaJezikRezultatČas oddaje
scnm1-2018 Presek Java 100/100OK 04. okt '18 @ 16:45

Test Točke Porabljen spomin Porabljen čas Status
#1 100/100 36,691 MiB 0,000 s OK

Ocenjevani program (n1.java):
import java.util.*;
import java.io.*;

public class n1 {

	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(in.readLine());
		for (int q = 0; q < n; q++) {
			StringTokenizer st = new StringTokenizer(in.readLine());
			int x1 = Integer.parseInt(st.nextToken());
			int y1 = Integer.parseInt(st.nextToken());
			int x2 = Integer.parseInt(st.nextToken());
			int y2 = Integer.parseInt(st.nextToken());
			int xk = Integer.parseInt(st.nextToken());
			int yk = Integer.parseInt(st.nextToken());
			int r = Integer.parseInt(st.nextToken());
			boolean f=false;
			for(int i=x1;i<=x2&&!f;i++) {
				for(int j=y1;j<=y2&&!f;j++) {
					if((xk-i)*(xk-i)+(yk-j)*(yk-j)<=r*r) {
						System.out.println(i+" "+j);
						f=true;
					}
				}
			}
			if(!f) {
				System.out.println("Presek je prazen");
			}
		}
	}

}