UVALive 6655 Two Points Revisited








     

这题好水,求垂直的线段,求出原来线段的长度,在原点旋转90即可。



#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
struct Point{
    int x,y;
};

int main(){
    int s,n,tt=1;
    Point a1,b1,a2,b2;
    scanf("%d",&n);
    while(n--){
        scanf("%d%d%d%d",&a1.x,&a1.y,&a2.x,&a2.y);
        if(a1.x >a2.x) swap(a1,a2);

        int dy = abs(a1.y-a2.y),dx = abs(a1.x-a2.x);
        b1.x = 0, b2.x = dy;
        if(a1.y < a2.y)
            b1.y = dx,b2.y=0;
        else b1.y = 0,b2.y=dx;
        printf("Case %d: %d %d %d %d\n",tt++,b1.x,b1.y,b2.x,b2.y);


    }
    return 0;
}




你可能感兴趣的:(uvalive,Two,Points,6655,Revisited)