01 December 2015

UVA 10250 - The Other Two Trees

/***
Md. Namzul Hasan
Shahjalal University of Science & Technology,Sylhet.
hasan08sust@gmail.com
***/
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define load(array,size)  for(int i=0 ; i<size ; i++) cin>>array[i]  ;
#define new_line  pf("\n")
#define clear_data(array) memset(array,0,sizeof(array))
#define highest_int 2147483647


double mx, my ;

void midValue(double x1, double y1, double x2, double y2)
{
    mx = (x1 + x2)/2 ;
    my = (y1 + y2)/2 ;
}

double dis(double x1, double y1, double x2, double y2)
{
    double d = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)) ;
    return d ;
}

int main()
{
    double x1, y1, x2,y2 ;
    while(cin>>x1>>y1>>x2>>y2)
    {

        midValue(x1, y1, x2,y2) ;
        double dx = x1 -mx ;
        double dy = y1 - my;
        double x3 = mx +dy ;
        double y3 = my - dx ;
        double x4 = mx - dy ;
        double y4 = my + dx ;

            pf("%.10lf %.10lf %.10lf %.10lf\n",x3,y3,x4,y4) ;

    }
    return 0;
}

No comments:

Post a Comment

UVA 10679 - I Love Strings!!