zoukankan      html  css  js  c++  java
  • 德莱联盟

    德莱联盟

    时间限制:1000 ms  |  内存限制:65535 KB
    难度:1
     
    描述

    欢迎来到德莱联盟。。。。

    德莱文。。。

    德莱文在逃跑,卡兹克在追。。。。

    我们知道德莱文的起点和终点坐标,我们也知道卡兹克的起点和中点坐标,问:卡兹克有可能和德莱文相遇吗?,并且保证他们走的都是直线。

     
    输入
    几组数据,一个整数T表示T组数据
    每组数据 8个实数,分别表示德莱文的起点和终点坐标,以及卡兹克的起点和终点坐标
    输出
    如果可能 输出 Interseetion,否则输出 Not Interseetion
    样例输入
    2
    -19.74 7.14 22.23 -27.45 -38.79 -5.08 47.51 34.01
    -8.61 9.91 -32.47 6.47 -3.81 -16.1 7.82 -6.37
    样例输出
    Interseetion
    Not Interseetion

    code:
    package acmjihe;
    
    import java.util.Scanner;
    
    public class Main1 {
    
    	public static void main(String[] args) {
    		Scanner input = new Scanner(System.in);
    		int n = input.nextInt();
    		for (int i = 0; i < n; i++) {
    			double a = input.nextDouble();
    			double b = input.nextDouble();
    			double c = input.nextDouble();
    			double d = input.nextDouble();
    			double e = input.nextDouble();
    			double f = input.nextDouble();
    			double g = input.nextDouble();
    			double h = input.nextDouble();
    
    			double x1 = (e - a) * (d - b) - (f - b) * (c - a);
    			double x2 = (g - a) * (d - b) - (h - b) * (c - a);
    			double y1 = (a - e) * (h - f) - (b - f) * (g - e);
    			double y2 = (c - e) * (h - f) - (d - f) * (g - e);
    
    			if ((x1 * x2 < 0) && (y1 * y2 < 0)) {
    				System.out.printf("Interseetion
    ");
    			} else {
    				System.out.printf("Not Interseetion
    ");
    			}
    
    		}
    	}
    
    }
    

      

  • 相关阅读:
    bzoj1797
    bzoj1266
    bzoj1497
    bzoj1412
    bzoj3156
    JSOI2014第三轮总结
    bzoj1855
    bzoj1044
    codeforces 371D
    codeforces 371B
  • 原文地址:https://www.cnblogs.com/airycode/p/5554291.html
Copyright © 2011-2022 走看看