Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- public class probd {
- public static void main(String args[]) throws IOException {
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- String line = br.readLine();
- String[] xy = line.split(" ");
- int x1 = Integer.parseInt(xy[0]);
- int y1 = Integer.parseInt(xy[1]);
- while(x1 >= 0){
- line = br.readLine();
- xy = line.split(" ");
- int x2 = Integer.parseInt(xy[0]);
- int y2 = Integer.parseInt(xy[1]);
- line = br.readLine();
- xy = line.split(" ");
- int x3 = Integer.parseInt(xy[0]);
- int y3 = Integer.parseInt(xy[1]);
- double m = (y1 - y2)/(x1 - x2);
- double a = m;
- double b = -1;
- double c = - m * x1 + y1;
- if(a * x3 + b * y3 + c == 0){
- System.out.println("Em cima do muro.");
- }
- else if(a * x3 + b * y3 + c > 0){
- System.out.println("Direita!");
- }
- else {
- System.out.println("Esquerda!");
- }
- line = br.readLine();
- xy = line.split(" ");
- x1 = Integer.parseInt(xy[0]);
- y1 = Integer.parseInt(xy[1]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement