青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品


Intersecting Lines

Time Limit: 1000MS Memory Limit: 10000K
Total Submissions: 4260 Accepted: 2049

Description

We all know that a pair of distinct points on a plane defines a line and that a pair of lines on a plane will intersect in one of three ways: 1) no intersection because they are parallel, 2) intersect in a line because they are on top of one another (i.e. they are the same line), 3) intersect in a point. In this problem you will use your algebraic knowledge to create a program that determines how and where two lines intersect.
Your program will repeatedly read in four points that define two lines in the x-y plane and determine how and where the lines intersect. All numbers required by this problem will be reasonable, say between -1000 and 1000.

Input

The first line contains an integer N between 1 and 10 describing how many pairs of lines are represented. The next N lines will each contain eight integers. These integers represent the coordinates of four points on the plane in the order x1y1x2y2x3y3x4y4. Thus each of these input lines represents two lines on the plane: the line through (x1,y1) and (x2,y2) and the line through (x3,y3) and (x4,y4). The point (x1,y1) is always distinct from (x2,y2). Likewise with (x3,y3) and (x4,y4).

Output

There should be N+2 lines of output. The first line of output should read INTERSECTING LINES OUTPUT. There will then be one line of output for each pair of planar lines represented by a line of input, describing how the lines intersect: none, line, or point. If the intersection is a point then your program should output the x and y coordinates of the point, correct to two decimal places. The final line of output should read "END OF OUTPUT".

Sample Input

5
0 0 4 4 0 4 4 0
5 0 7 6 1 0 2 3
5 0 7 6 3 -6 4 -3
2 0 2 27 1 5 18 5
0 3 4 0 1 2 2 5

Sample Output

INTERSECTING LINES OUTPUT
POINT 2.00 2.00
NONE
LINE
POINT 2.00 5.00
POINT 1.07 2.20
END OF OUTPUT
/*************************************
計(jì)算幾何基礎(chǔ)題,判斷直線相交及求交點(diǎn)
注意斜率不存在的情況
*************************************
*/

#include 
<iostream>
#include 
<cstdio>

int main()
{
    
double x1, y1, x2, y2, x3, y3, x4, y4;
    
int n;
    
double k1, k2;
    
double b1, b2;
    
double i_x, i_y;
    scanf(
"%d"&n);
    std::cout 
<< "INTERSECTING LINES OUTPUT" << std::endl;
    
while( n-- )
    
{
        scanf(
"%lf%lf%lf%lf%lf%lf%lf%lf"&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);

        
if( x1 != x2 && x3 != x4 )
        
{
            k1 
= ( y2 - y1 ) / ( x2 - x1 );
            k2 
= ( y4 - y3 ) / ( x4 - x3 );
            b1 
= y1 - k1 * x1;
            b2 
= y3 - k2 * x3;
            
if( k1 == k2 )
            
{
                
if( b1 == b2 )
                    printf(
"LINE\n");
                
else
                    printf(
"NONE\n");
            }

            
else
            
{
                i_x 
= (b2 - b1) / (k1 - k2);
                i_y 
= k1 * i_x + b1;
                printf(
"POINT %.2lf %.2lf\n", i_x, i_y);
            }

        }

        
else if( x1 == x2 && x3 == x4 )
        
{
            
if( x1 == x3 )
            std::cout 
<< "LINE\n";
            
else
            std::cout 
<< "NONE\n";
        }

        
else if( x1 == x2 && x3 != x4 )
        
{
            k2 
= ( y4 - y3 ) / ( x4 - x3 );
            b2 
= y3 - k2 * x3;
            i_x 
= x1;
            i_y 
= k2 * x1 + b2;
            printf(
"POINT %.2lf %.2lf\n", i_x, i_y);
        }

        
else
        
{
            k1 
= ( y2 - y1 ) / ( x2 - x1 );
            b1 
= y1 - k1 * x1;
            i_x 
= x3;
            i_y 
= k1 * x3 + b1;
            printf(
"POINT %.2lf %.2lf\n", i_x, i_y);
        }

    }

    std::cout 
<< "END OF OUTPUT\n";
    
return 0;
}

posted on 2010-10-03 11:03 Vontroy 閱讀(822) 評(píng)論(0)  編輯 收藏 引用 所屬分類: 計(jì)算幾何POJ

只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲福利国产精品| 亚洲一区在线视频| 免费亚洲视频| 久久一二三国产| 亚洲全部视频| 99精品欧美一区二区蜜桃免费| 欧美日韩精品一二三区| 亚洲午夜国产成人av电影男同| 夜久久久久久| 国产丝袜一区二区三区| 狼狼综合久久久久综合网 | 久热精品在线视频| 蜜桃久久精品乱码一区二区| 亚洲精品国产精品国自产在线 | 免费在线看成人av| 日韩一区二区精品视频| 亚洲午夜激情网页| 红桃av永久久久| 亚洲人成亚洲人成在线观看| 欧美日韩一区二区视频在线观看| 午夜精品国产精品大乳美女| 久久久噜噜噜久久久| 99视频日韩| 久久精品视频网| 亚洲一区在线免费| 久久久久久久久岛国免费| 日韩视频在线免费观看| 香蕉尹人综合在线观看| 亚洲精品免费看| 午夜精品三级视频福利| 99热免费精品| 久久精品视频免费观看| 亚洲自拍都市欧美小说| 免费不卡视频| 久久精品在线播放| 欧美日精品一区视频| 欧美freesex交免费视频| 国产精品国产三级国产aⅴ浪潮| 欧美va天堂在线| 国产美女精品一区二区三区| 亚洲精品久久久久久久久| 国语精品一区| 亚洲一区尤物| 亚洲一区二区在线免费观看视频 | 一本在线高清不卡dvd| 亚洲国产精品成人| 校园春色国产精品| 亚洲男同1069视频| 欧美日韩成人在线| 亚洲二区在线| 在线看无码的免费网站| 亚洲欧美一区二区原创| 亚洲欧美一级二级三级| 欧美日本在线看| 欧美激情精品久久久久久蜜臀 | 国产麻豆成人精品| 亚洲色图综合久久| 亚洲特级片在线| 欧美日韩国产综合网| 亚洲黄一区二区三区| 在线观看亚洲a| 久久久久久久一区| 欧美成人小视频| 在线观看精品| 鲁大师成人一区二区三区 | 亚洲欧洲一区二区三区| 久久免费高清| 欧美成人精品| 亚洲精品视频在线| 欧美激情中文字幕乱码免费| 亚洲国产精品成人| 在线一区二区日韩| 欧美午夜精品久久久久久浪潮| 9l视频自拍蝌蚪9l视频成人| 亚洲一区在线观看视频| 国产精品免费在线| 欧美一级播放| 久久在线播放| 亚洲人永久免费| 欧美日韩视频在线一区二区观看视频 | 久久久夜夜夜| 在线观看欧美亚洲| 亚洲欧美国产另类| 国产精品自拍小视频| 欧美中文日韩| 亚洲第一精品夜夜躁人人爽| 亚洲激精日韩激精欧美精品| 欧美高清在线播放| 99精品视频免费| 久久精品成人一区二区三区 | 欧美激情一区二区三区| 一本色道久久综合一区| 久久精品亚洲一区| 亚洲肉体裸体xxxx137| 欧美性大战久久久久久久蜜臀 | 欧美福利视频在线| 亚洲天堂av图片| 国产一级揄自揄精品视频| 蜜臀91精品一区二区三区| 999在线观看精品免费不卡网站| 亚洲欧美影院| 亚洲电影av在线| 欧美偷拍一区二区| 久久精彩免费视频| 日韩一级大片| 欧美xx69| 久久福利资源站| 亚洲青涩在线| 国产性猛交xxxx免费看久久| 欧美丰满高潮xxxx喷水动漫| 一区二区三区你懂的| 麻豆成人91精品二区三区| 亚洲天堂成人| 亚洲黄色一区二区三区| 国产日韩av高清| 欧美日本韩国在线| 久久免费少妇高潮久久精品99| 日韩亚洲一区二区| 欧美国产日本韩| 欧美在线在线| 亚洲欧美日韩精品久久久久| 亚洲黄色成人| 在线观看视频欧美| 国产在线精品二区| 国产欧美日韩一区二区三区在线| 欧美国产日韩免费| 久久亚洲精品视频| 久久成人18免费观看| 亚洲综合视频在线| 一区二区三区四区五区在线| 亚洲清纯自拍| 亚洲电影在线看| 美女免费视频一区| 久久在线视频| 久久久久久999| 久久精品国产精品亚洲精品| 亚洲欧美国产精品专区久久| 亚洲婷婷综合久久一本伊一区| 亚洲每日更新| 亚洲欧洲视频在线| 亚洲人午夜精品免费| 91久久精品www人人做人人爽| 狠狠色丁香婷婷综合影院| 国产亚洲成精品久久| 国产欧美日韩视频一区二区三区| 欧美视频一区二区三区…| 欧美日韩三区| 国产精品久久综合| 国产麻豆91精品| 国产偷国产偷精品高清尤物| 国产一区二区看久久| 国内免费精品永久在线视频| 激情久久五月| 亚洲经典三级| 亚洲视频中文| 久久aⅴ国产紧身牛仔裤| 久久国产免费| 欧美ed2k| 亚洲精品色婷婷福利天堂| 99re成人精品视频| 亚洲综合成人婷婷小说| 欧美在线亚洲综合一区| 美女网站久久| 欧美精品二区| 国产精品欧美日韩| 激情亚洲成人| 日韩视频在线一区二区| 亚洲淫片在线视频| 久久精品视频免费播放| 欧美国产先锋| 一个色综合av| 久久久噜噜噜久噜久久| 欧美精品在欧美一区二区少妇| 欧美视频中文一区二区三区在线观看| 国产精品麻豆va在线播放| 国产综合色在线视频区| 亚洲精品一区在线观看香蕉| 亚洲一区二区视频在线观看| 久久蜜桃精品| 日韩视频一区二区| 久久久久亚洲综合| 欧美色图五月天| 伊人蜜桃色噜噜激情综合| 亚洲视频一二三| 久久先锋影音av| 亚洲视屏一区| 欧美高清视频免费观看| 国产精品影片在线观看| 亚洲乱码国产乱码精品精可以看| 欧美一区成人| 亚洲毛片一区二区| 久久午夜av| 国产三级欧美三级日产三级99| 亚洲精品影院| 久久五月激情| 午夜激情综合网| 欧美午夜电影在线| 亚洲蜜桃精久久久久久久| 麻豆成人在线观看| 欧美亚洲一区二区三区|