02 December 2015

UVA 11068 - An Easy Task

/***
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

int main()
{
    int a1,b1,c1,a2,b2,c2 ;

    while(sc("%d %d %d %d %d %d",&a1,&b1,&c1,&a2,&b2,&c2))
    {
        if(a1==0 && b1==0 &&c1==0 && a2==0 && b2==0 && c2==0)
            break ;

        int divisor = a1*b2 - a2*b1 ;
        if(divisor)
        {
            double x, y ;
            int z = b2*c1 -b1*c2 ;

            if(z)
                x = z/(double)divisor  ;
            else
                x =0.0 ;
            z = c2*a1- c1*a2 ;
            if(z)
                y = z/(double)divisor  ;
            else
                y = 0.0 ;

            pf("The fixed point is at %.2lf %.2lf.\n",x,y) ;
        }
        else
            pf("No fixed point exists.\n") ;

    }
    return 0;
}

No comments:

Post a Comment

UVA 10679 - I Love Strings!!