Problem:


Simultaneous Equation

Write a program which solve a simultaneous equation:

 ax + by = c

 dx + ey = f

The program should print x and y for given a, b, c, d, e and f (-1,000 ≤ a, b, c, d, e, f ≤ 1,000). You can suppose that given equation has a unique solution.

Input

The input consists of several data sets, 1 line for each data set. In a data set, there will be a, b, c, d, e, f separated by a single space. The input terminates with EOF.

Output

For each data set, print x and y separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.

Sample Input 1

1 2 3 4 5 6
2 -1 -2 -1 -1 -5

Output for the Sample Input 1

-1.000 2.000
1.000 4.000

Sample Input 2

2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27

Output for the Sample Input 2

0.000 3.000
0.000 3.000



Sample input:
1 2 3 4 5 6
2 -1 -2 -1 -1 -5


Sample output:
-1.000 2.000
1.000 4.000

Submission status: Wrong Answer

Solution code:
while True:
	try:
		a,b,c,d,e,f = map(float,raw_input().split())
		x = (e*c-b*f) / (e*a-b*d)
		y = (c*d-a*f) / (b*d-e*a)
		print '%.3f %.3f' % (x,y)
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        line = input()
    except:
        break
    a,b,c,d,e,f = map(int, line.strip().split())
    z = a * e - b * d
    x = (c * e - b * f) / z
    y = (a * f - c * d) / z
    print('{:.3f} {:.3f}'.format(x, y))

Submission status: Time Limit Exceeded

Solution code:
import sys

while (True):
    L = map(float, sys.stdin.readline().split())
    if L:
        (a, b, c, d, e, f) = L
        x = (e * c - b * f) / (a * e - b * d)
        y = (a * f - d * c) / (a * e - b * d)

        print x, y

Submission status: Time Limit Exceeded

Solution code:
import sys
import time
def anscheck(x,y,d,e,f):
    # print "%.3f %.3f %.3f %.3f %.3f"%(x,y,d,e,f)
    if d*x+e*y == f:
        # print "correct!"
        print "%.3f %.3f"%(x,y)
        return True
    else:
        # print "different"
        return False
for line in sys.stdin:
    a,b,c,d,e,f = map(float,line.split())
    i=1
    while True:
        if (a*i-c) % b ==0:
            x=i
            if a*i-c>0:
                y= -((a*i-c)/b)
            elif a*i-c<0:
                y= (a*i-c)/b
            else:
                pass
            if anscheck(x,y,d,e,f):
                break
        # if b*i-c % a == 0:
        #     x=i
        #     if b*i>c:
        #         y= -(b*i-c)/a
        #     elif b*i<c:
        #         y= (b*i-c)/a
        #     else:
        #         pass
        #     anscheck(x,y,d,e,f)
        if (a*(-i)-c) % b ==0:
            x=-i
            if a*(-i)-c>0:
                y= (a*(-i)-c)/b
            elif a*(-i)-c<0:
                y= -((a*(-i)-c)/b)
            else:
                pass
            if anscheck(x,y,d,e,f):
                break
        # if b*(-i)-c % a ==0:
        #     x=-i
        #     if b*(-i)>c:
        #         y= -(b*(-i)-c)/a
        #     elif b*(-i)<c:
        #         y= (b*(-i)-c)/a
        #     else:
        #         pass
        #     anscheck(x,y,d,e,f)
        i+=1.0

Submission status: Time Limit Exceeded

Solution code:
import sys
import time
def anscheck(x,y,d,e,f):
    # print "%.3f %.3f %.3f %.3f %.3f"%(x,y,d,e,f)
    if d*x+e*y == f:
        # print "correct!"
        print "%.3f %.3f"%(x,y)
        return True
    else:
        # print "different"
        return False
for line in sys.stdin:
    a,b,c,d,e,f = map(float,line.split())
    i=1
    while True:
        if (a*i-c) % b ==0:
            x=i
            if a*i-c>0:
                if b>0:
                    y= -((a*i-c)/b)
                else:
                    y= (a*i-c)/b
            elif a*i-c<0:
                if b>0:
                    y= -((a*i-c)/b)
                else:
                    y= (a*i-c)/b
            else:
                pass
            if anscheck(x,y,d,e,f):
                break
        # if b*i-c % a == 0:
        #     x=i
        #     if b*i>c:
        #         y= -(b*i-c)/a
        #     elif b*i<c:
        #         y= (b*i-c)/a
        #     else:
        #         pass
        #     anscheck(x,y,d,e,f)
        if (a*(-i)-c) % b ==0:
            x=-i
            if a*(-i)-c>0:
                if b>0:
                    y= -((a*(-i)-c)/b)
                else:
                    y= (a*(-i)-c)/b
            elif a*(-i)-c<0:
                if b>0:
                    y= -((a*(-i)-c)/b)
                else:
                    y= (a*(-i)-c)/b
            else:
                pass
            if anscheck(x,y,d,e,f):
                break
        # if b*(-i)-c % a ==0:
        #     x=-i
        #     if b*(-i)>c:
        #         y= -(b*(-i)-c)/a
        #     elif b*(-i)<c:
        #         y= (b*(-i)-c)/a
        #     else:
        #         pass
        #     anscheck(x,y,d,e,f)
        i+=1.0

Submission status: Time Limit Exceeded

Solution code:
import sys
import time
def anscheck(x,y,d,e,f):
    # print "%.3f %.3f %.3f %.3f %.3f"%(x,y,d,e,f)
    # time.sleep(1)
    if d*x+e*y == f:
        # print "correct!"
        print "%.3f %.3f"%(x,y)
        return True
    else:
        # print "different"
        return False
for line in sys.stdin:
    a,b,c,d,e,f = map(float,line.split())
    i=0
    while True:
        if (a*i-c) % b ==0:
            x=i
            if a*i-c>0:
                y= -((a*i-c)/b)
            elif a*i-c<0:
                y= (a*i-c)/b
            else:
                y=0
            if anscheck(x,y,d,e,f):
                break
        # if b*i-c % a == 0:
        #     x=i
        #     if b*i>c:
        #         y= -(b*i-c)/a
        #     elif b*i<c:
        #         y= (b*i-c)/a
        #     else:
        #         pass
        #     anscheck(x,y,d,e,f)
        if (a*(-i)-c) % b ==0:
            x=-i
            if a*(-i)-c > 0:
                y= (a*(-i)-c)/b
            elif a*(-i)-c<0:
                y= -((a*(-i)-c)/b)
            else:
                y=0
            if anscheck(x,y,d,e,f):
                break
        # if b*(-i)-c % a ==0:
        #     x=-i
        #     if b*(-i)>c:
        #         y= -(b*(-i)-c)/a
        #     elif b*(-i)<c:
        #         y= (b*(-i)-c)/a
        #     else:
        #         pass
        #     anscheck(x,y,d,e,f)
        i+=1.0

Submission status: Time Limit Exceeded

Solution code:
import sys
import time
def anscheck(x,y,d,e,f):
    # print "%.3f %.3f %.3f %.3f %.3f"%(x,y,d,e,f)
    # time.sleep(1)
    if d*x+e*y == f:
        # print "correct!"
        print "%.3f %.3f"%(x,y)
        return True
    else:
        # print "different"
        return False
for line in sys.stdin:
    a,b,c,d,e,f = map(float,line.split())
    i=0
    while True:
        tmp = c-a*i
        if tmp % b ==0:
            x=i
            y=tmp/b
            if anscheck(x,y,d,e,f):
                break
        tmp = c-a*(-i)
        if tmp % b ==0:
            x=-i
            y=tmp/b
            if anscheck(x,y,d,e,f):
                break
        i+=1.0

Submission status: Time Limit Exceeded

Solution code:
import itertools
import operator

dataset = []
while True:
    try:
        dataset.append(input())
    except EOFError:
        break

for item in dataset:
    a, b, c, d, e, f = [int(i) for i in item.split()]
    for i in range(-1000, 1001):
        for j in range(-1000, 1001):
            if a * i + b * j == c and d * i + e * j == f:
                print("{:.3f} {:.3f}".format(i, j))

Submission status: Time Limit Exceeded

Solution code:
z = []
while True:
	try:
		a, b, c, d, e, f = map(float, raw_input().split())
		x = (c * e - b * f) / (a * e - d * b)
		y = (c * d - f * a) / (b * d - e * a)
		z.append([x, y])
	
	except:
		print(z)

Submission status: Accepted

Solution code:
while True:
    try:
        a,b,c,d,e,f=map(int,input().split())
        print("{0:.3f} {1:.3f}".format((c*e-b*f)/(a*e-b*d)+1e-10,(a*f-c*d)/(a*e-b*d)+1e-10))
    except:break

Submission status: Accepted

Solution code:
while True:
    try:
        a, b, c, d, e, f = map(float, raw_input().split())
    except:
        break

    y = (c*d-a*f)/(b*d-a*e)
    x=(c - b*y) / a
    print "%.3f %.3f" % (x, y)

Submission status: Accepted

Solution code:
while True:
    try:
        a, b, c, d, e, f = map(int, input().split())
    except:
        break
    y = (c*d-f*a) / (b*d-e*a)
    x = (c - b*y) / a
    print("{:.3f} {:.3f}".format(x, y))

Submission status: Accepted

Solution code:
while True:
    try:
        (a,b,c,d,e,f)  =  map(int,input().split())
    except:
        break
    g = (a * e)  - (b * d)
    ans1= "{0:.3f}".format((( e * c) + ( -b * f)) / g + 0)
    ans2= "{0:.3f}".format(((-d * c) + (  a * f)) / g + 0)
    print (ans1,ans2)

Submission status: Accepted

Solution code:
EPS = 0.0001
while True:
    try:
        a = list(map(float, input().split()))
        dd = a[0]*a[4]-a[3]*a[1]
        d1 = a[2]*a[4]-a[5]*a[1]
        d2 = a[0]*a[5]-a[3]*a[2]
        print("{0:.3f} {1:.3f}".format(d1/dd+EPS, d2/dd+EPS))
    except EOFError:
        break

Submission status: Accepted

Solution code:
def equation(a,b,c,d,e,f,x):
    buff = a*e-b*d
    buff_a = a

    a = e/buff
    b = -b/buff
    d = -d/buff
    e = buff_a/buff

    x.append((a*c)+(b*f))
    x.append((d*c)+(e*f))

count = 0
a = []
b = []
c = []
d = []
e = []
f = []

while True:
    try:
        buff = input().split()
        a.append(float(buff[0]))
        b.append(float(buff[1]))
        c.append(float(buff[2]))  
        d.append(float(buff[3]))
        e.append(float(buff[4]))
        f.append(float(buff[5]))
        count += 1
    except:
        break

for i in range(count):
    ans = []

    equation(a[i],b[i],c[i],d[i],e[i],f[i],ans)
    print('{:.3f}'.format(ans[0]),'{:.3f}'.format(ans[1]))

Submission status: Accepted

Solution code:
while True:
    try:
        a,b,c,d,e,f=[int(i) for i in input().split()]
        x=(c*e-f*b)/(a*e-b*d)
        y=(a*f-d*c)/(a*e-b*d)
        if abs(x)<1e-4:
            x=0.0
        if abs(y)<1e-4:
            y=0.0
        print("{:.3f} {:.3f}".format(x,y))
    except:
        break

Submission status: Accepted

Solution code:
#det = ae - bd
#x = (ce - bf) / det
#y = (af - cd) / det

#-0.000 対策
EPS = 1e-4

while True:
    try:
        a, b, c, d, e, f = map(float, input().split())
        det = a*e - b*d
        x = (c*e - b*f) / det + EPS
        y = (a*f - c*d) / det + EPS
        print('{0:.3f} {1:.3f}'.format(x, y))
    
    except EOFError:
        break

Submission status: Accepted

Solution code:
while True:
  try:
    a, b, c, d, e, f = map(float, input().split())
  except EOFError:
    break

  det = a * e - b * d
  if det != 0:
    x = (1 / det) * (e * c - b * f)
    y = (1 / det) * (a * f - c * d)
    if x >= 0:
      xx = (int)(x * 1000)
      if xx % 10 <= 4:
        ansx = (xx - xx%10) / 1000
      else:
        ansx = (xx + (10 - xx%10)) / 1000
    else:
      xx = (int)(x * -1000)
      if xx % 10 <= 4:
        ansx = (xx - xx%10) / -1000
      else:
        ansx = (xx + (10 - xx%10)) / -1000
      
    if y >= 0:
      yy = (int)(y * 1000)
      if yy % 10 <= 4:
        ansy = (yy - yy%10) / 1000
      else:
        ansy = (yy + (10 - yy%10)) / 1000
    else:
      yy = (int)(y * -1000)
      if yy % 10 <= 4:
        ansy = (yy - yy%10) / -1000
      else:
        ansy = (yy + (10 - yy%10)) / -1000
    print("{0:.3f} {1:.3f}".format(ansx, ansy))

Submission status: Accepted

Solution code:
#! -*- coding: utf-8-unix -*-
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0004
import sys

def main_(a,b,c,d,e,f):
  y = (a*f-d*c)/(a*e-d*b)
  x = (c - b * y) / a
  return (x, y)

def main(lines):
  for line in lines:
    a,b,c,d,e,f = map(float, line.split(' '))
    print '%.3f %.3f' % main_(a,b,c,d,e,f)
  return

if __name__=='__main__':
  lines = []
  for line in sys.stdin:
    lines.append(line.strip())
  # print lines
  main(lines)

Submission status: Accepted

Solution code:
while True:
    try:
        a, b, c, d, e, f = map(int, input().strip("\n").split(" "))
        z = a * e - b * d
        if z == 0:
            break
        x = (c * e - b * f)
        y = (f * a - c * d)
        x /= z
        y /= z
        # zero toshite atsukau
        if -0.0004 < x < 0.0004:
            x = abs(x)
        if -0.0004 < y < 0.0004:
            y = abs(y)
        print("{0:.3f} {1:.3f}".format(x, y))

    except EOFError:
        break  # escape from while loop

Submission status: Accepted

Solution code:
while True:
	try:
		[a, b, c, d, e, f] = map(float, raw_input().split())
		i = d/a
		j = i * b - e
		k = i * c - f
		y = float(k/j)
		x = float((c - b * y)/a)
		print "%.3f %.3f" % (x, y)
	except (EOFError):
		break;

Submission status: Accepted

Solution code:
while True:
    try:
        (a,b,c,d,e,f)=map(float,raw_input().split())
        x=(f-c*e/b)/(d-a*e/b)
        y=(c-a*x)/b
        if abs(x)<1e-3:
            x=0
        if abs(y)<1e-3:
            y=0
        print "%.3f %.3f" % (x,y)
    except EOFError: break

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

for s in sys.stdin:
  d = map( float, s.split() )
  det = d[0]*d[4]-d[1]*d[3]
  x = ( d[4]*d[2]-d[1]*d[5] ) / det
  y = ( -d[3]*d[2]+d[0]*d[5] ) / det
  if x == 0:
    x = 0
  if y == 0:
    y = 0
  print "%.3f %.3f" % ( x, y )

Submission status: Accepted

Solution code:
import math
import itertools

while 1:
    try:
        a, b, c, d, e, f = map(int, input().split())
        print('{0:.3f} {1:.3f}'.format((e*c-b*f)/(a*e-b*d)+0, (-d*c+a*f)/(a*e-b*d)+0))
    except:
        break

Submission status: Accepted

Solution code:
while 1:
    try:
        a, b, c, d, e, f = map(int, input().split())
        y = (-d*c+a*f)/(a*e-b*d)
        print('{:.3f} {:.3f}'.format((c-b*y)/a, y))
    except EOFError:
        break

Submission status: Accepted

Solution code:
while 1:
    try:
        i = raw_input()
        a, b, c, d, e, f = map(float, i.split())
        y = ((c * d) - (a * f)) / ((b * d) - (a * e))
        x = (c - (b * y)) / a
        print "%.3f %.3f" % (x, y)
    except:
        break

Submission status: Accepted

Solution code:
while True:
	try:
		a,b,c,d,e,f = map(float,input().split())
		y=(a*f-c*d)/(a*e-b*d)
		x=(c-b*y)/a
		print('{:.3f} {:.3f}'.format(x,y))
	except:
		break;

Submission status: Accepted

Solution code:
import sys
for line in sys.stdin.readlines():
    a, b, c, d, e, f  = map(float, line.strip().split())
    y = ((c * d) - (a * f)) / ((b * d) - (a * e))
    x = (c - (b * y)) / a
    print "{0:.3f}".format(x),
    print "{0:.3f}".format(y)

Submission status: Accepted

Solution code:
# coding: utf8

import sys

for line in sys.stdin:
    a, b, c, d, e, f = map(float, line.split())

    if (c * e - b * f) == 0:
        x = 0.0
    else:
        x = round((c*e-b*f)/(a*e-b*d), 3)

    if (c * d - a * f) == 0:
        y = 0.0
    else:
        y = round((c*d-a*f)/(b*d-a*e), 3)

    print '%.3f %.3f' % (x, y)

Submission status: Accepted

Solution code:
import sys
 
for s in sys.stdin:
  a, b, c, d, e, f = map(float, s.split())
  y = (a*f - d*c)/(a*e - d*b)
  x = (c - b*y)/a
  print '%.03f %.03f'%(x, y)

Submission status: Accepted

Solution code:
import sys

for line in sys.stdin:
    a, b, c, d, e, f = map(int, line.split())
    y = (a * f - d * c) / (a * e - b * d)
    x = (c * e - b * f) / (a * e - b * d)
    if x == 0:        x = abs(x)
    if y == 0:        x = abs(y)       
    print('{:.3f} {:.3f}'.format(x, y))

Submission status: Accepted

Solution code:
from __future__ import division
while True:
	try:
		a, b, c, d, e, f = map(int, raw_input().split())
		D = a*e - b*d
		Dx = c*e - b*f
		Dy = a*f - c*d
		print("%.3f %.3f" % (Dx/D + 0, Dy/D + 0))
	except EOFError:
		break

Submission status: Accepted

Solution code:
while True:
    try:
        a,b,c,d,e,f = map(int, raw_input().split())
        
        x = float(c*e-b*f)/(a*e-b*d)
        y = float(-d*c+a*f)/(a*e-b*d)
        print '%.3f %.3f' %(round(x,3) + 0, round(y,3) + 0)
        
    except EOFError:
        break

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def Print(array):
    for r in range(len(array)):
        print(array[r])
    print()


def Gauss(array):
    # for r in range(len(array)):
    #     array[r].append(r)

    for r in range(len(array)):
        # array.sort(key=lambda x: x[r], reverse=True)
        div = array[r][r]
        for c in range(r, len(array) + 1):
            array[r][c] /= div
        for r2 in range(r + 1, len(array)):
            head = array[r2][r]
            for c in range(r, len(array) + 1):
                array[r2][c] -= head * array[r][c]

    result = [0] * len(array)
    for r in range(len(array) - 1, -1, -1):
        result[r] = array[r][
            len(array)] - sum([result[x] * array[r][x] for x in range(r + 1, len(array))])
    return result


for line in sys.stdin:
    [a, b, c, d, e, f] = [int(x) for x in line.split()]
    result = Gauss([[a, b, c], [d, e, f]])
    for i in range(len(result) - 1):
        print("{0:.3f}".format(result[i]), end=" ")
    print("{0:.3f}".format(result[-1]))

Submission status: Accepted

Solution code:
while True:
    try:
        a,b,c,d,e,f = map(float,raw_input().split())
        delta =a*e-b*d
        x = (e*c-b*f)/delta
        y = (a*f-d*c)/delta
        if abs(x)<1e-3:
            x=0
        if abs(y)<1e-3:
            y=0
        #print str('%.3f' % x) + " " + str('%.3f' % y)
        print "%.3f %.3f" % (x,y)
    except EOFError:
        break

Submission status: Accepted

Solution code:
#! /usr/bin/python3

while True:
    try:
        l=list(map(int, input().split()))
        x=(l[1]*l[5]-l[2]*l[4])/(l[1]*l[3]-l[0]*l[4])
        y=(l[2]-l[0]*x)/l[1]
        if x == 0: x = 0
        print( "{0:.3f} {1:.3f}".format(x,y))
    except:
        break

Submission status: Accepted

Solution code:
import sys
for line in sys.stdin:
    a, b, c, d, e, f = map(int, line.rstrip('\n').split(' '))
    x = int((e*c - b*f) * 1000 / (a*e - b*d)) / 1000.0
    y = int((a*f - d*c) * 1000 / (a*e - b*d)) / 1000.0
    print '%.3f %.3f' % (x, y)

Submission status: Accepted

Solution code:
import sys
out=[]
for line in sys.stdin.readlines():
    num = map(float, line.strip().split())
    x = (num[2]*num[4] - num[1]*num[5]) / (num[0]*num[4] - num[1]*num[3])
    y = (num[5]*num[0] - num[2]*num[3]) / (num[0]*num[4] - num[3]*num[1])
    if x == 0:
        x=0.00
    if y == 0:
        y=0.00
    out.append( "%.3f %.3f"%(round(x,3),round(y,3)))
for i in xrange(len(out)):
    print out[i]

Submission status: Accepted

Solution code:
while True:
	try:
		temp = [float(x) for x in raw_input().split()]
		y = float(temp[0]*temp[5] - temp[3]*temp[2]) / (temp[0]*temp[4]-temp[3]*temp[1])
		x = float(temp[2] - temp[1]*y) / temp[0]
		print "%.3f %.3f" % (round(x, 3), round(y, 3))
			
	except:
		break

Submission status: Accepted

Solution code:
import sys
for abcdef in sys.stdin:
    a,b,c,d,e,f = map(float,abcdef.split(" "))
    if a!=0:
        y=(a*f-c*d)/(a*e-b*d)
        y=round(y,3)
        x=(c-b*y)/a
        x=round(x,3)
    else:
        y=c/b
        y=round(y,3)
        x=(f-e*y)/d
        x=round(x,3)
    print "{0:.3f} {1:.3f}".format(x,y)

Submission status: Accepted

Solution code:
while True:
    try:
        a,b,c,d,e,f = map(int,input().split(' '))
        z = a*e-b*d
        if z==0:
            break
        x = c*e-b*f
        y = a*f-c*d
        x /= z
        if -0.0004 < x < 0.0004:
            x = abs(x)
        y /= z
        if -0.0004 < y < 0.0004:
            y = abs(y)
        print('{:.3f} {:.3f}'.format(x,y))
    except:
        break

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

while True:
    try:
        a, b, c, d, e, f = map(float, input().split())
        x = (c*e - b*f) / (a*e - b*d)
        y = (a*f - d*c) / (a*e - b*d)
        print('{:.3f} {:.3f}'.format(x+0, y+0))
    except:
        break

Submission status: Accepted

Solution code:
# coding: utf-8
# import numpy as np
import sys
import math

def _read():
    for i in sys.stdin:
        yield map(int, i.split())

def _round(decimal):
    rounded = round(decimal * 1000) / 1000
    if rounded == -0.0:
        rounded = +0.0
    return rounded

for d in _read():
    [a,b,c,d,e,f] = map(float, d)
    dat = a * e - b * d
    x = (c * e - b * f) / dat
    y = (a * f - c * d) / dat
    [x, y] = map(_round, [x, y])

    print "%1.3f %1.3f" % (x, y)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import math

while True:
  try:
    ( a, b, c, d, e, f ) = map ( float, input ( ).split ( ) )
  except EOFError: break
  x = ( c * e - b * f ) / ( a * e - b * d )
  y = ( a * f - c * d ) / ( a * e - b * d )
  print ( "%.3f %.3f" % ( math.floor ( x * 1000 + 0.5 ) / 1000, math.floor ( y * 1000 + 0.5 ) / 1000 ) )

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import math

while True:
  try:
    ( a, b, c, d, e, f ) = map ( float, input ( ).split ( ) )
  except EOFError: break
  x = ( c * e - b * f ) / ( a * e - b * d )
  y = ( a * f - c * d ) / ( a * e - b * d )
  print ( "%.3f %.3f" % ( round ( x * 1e3 ) / 1e3, round ( y * 1e3 ) / 1e3 ) )

Submission status: Accepted

Solution code:
while True:
    try:
        line=input()

    except:
        break

    a,b,c,d,e,f=map(int, line.strip().split())

   
    
    y=(c*d-f*a)/(b*d-a*e)
    x=(c*e-f*b)/(a*e-b*d)

    if x<=0 and x>=-0.0005:
        x=0.000
    
    if y<=0 and y>=-0.0005:
        y=0.000
        
    print('{:.3f} {:.3f}'.format(x,y))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

while True:
    try:
        list = [float(x) for x in raw_input().split() ]
        x = (list[2]*list[4]-list[1]*list[5])/(list[0]*list[4]-list[1]*list[3])+0
        y = (list[0]*list[5]-list[2]*list[3])/(list[0]*list[4]-list[1]*list[3])+0

        print("%.3f %.3f" %(x, y))

    except EOFError:
        break

Submission status: Accepted

Solution code:
import sys
for l in sys.stdin:
	a,b,c,d,e,f=map(float,l.split())
	x=a*e-b*d
	print"%0.3f %0.3f"%(c*e/x-b*f/x,a*f/x-c*d/x)

Submission status: Accepted

Solution code:
import sys
from decimal import Decimal

def main():
    for input_line in sys.stdin:
        x1 = int(input_line.split(' ')[0])
        y1 = int(input_line.split(' ')[1])
        p = int(input_line.split(' ')[2])
        x2 = int(input_line.split(' ')[3])
        y2 = int(input_line.split(' ')[4])
        q = int(input_line.split(' ')[5])
        multiplicand1, multiplicand2 = calculate1(x1, x2)
        after_y1, after_y2, after_p, after_q = calculate2(y1, y2, p, q, multiplicand1, multiplicand2)
        calculate3(after_y1, after_y2, after_p, after_q, x1, y1, p)
    
def calculate1(x1, x2):
    if (x1 >= 0 and x2 >= 0) or (x1 < 0 and x2 < 0):
        multiplicand1 = -x2
        multiplicand2 = x1
        return multiplicand1, multiplicand2
    else:
        multiplicand1 = abs(x2)
        multiplicand2 = abs(x1)
        return multiplicand1, multiplicand2
    
def calculate2(y1, y2, p, q, multiplicand1, multiplicand2):
    after_y1 = Decimal(y1 * multiplicand1)
    after_y2 = Decimal(y2 * multiplicand2)
    after_p = Decimal(p * multiplicand1)
    after_q = Decimal(q * multiplicand2)
    return after_y1, after_y2, after_p, after_q

def calculate3(after_y1, after_y2, after_p, after_q, x1, y1, p):
    y = Decimal(after_p + after_q) / Decimal(after_y1 + after_y2)
    y = round(y, 3)
    x = Decimal(p - y1 * y) / Decimal(x1)
    x = round(x, 3)
    print('%.3f %.3f' % (x, y))
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
while(True):
		try:
			a,b,c,d,e,f=map(float,input().split(" "))
			z=a*e-b*d
			if(z!=0):
				x=(c*e-b*f)/z
				y=(a*f-c*d)/z
			print("{:.3f} {:.3f}".format(x+0,y+0))
		except:
			break

Submission status: Accepted

Solution code:
import sys
WS = sys.stdin.read()[:-1].split('\n')
for W in WS:
    a,b,c,d,e,f = map(float,W.split())
    x=(b*f-e*c)/(b*d-e*a)
    y=(c-a*x)/b
    x+=0
    y+=0
    print '%.3f %.3f' % (round(x,3),round(y,3))

Submission status: Accepted

Solution code:
import sys

input_lines = sys.stdin.readlines()


lines = map(lambda x: x[:-1], input_lines)

lines = map(lambda x: x.split(" "), lines)

#print lines

for l in lines:
    a, b, c, d, e, f = map(float, l)

    x = (c*e - b*f) / (e*a - b*d)
    y = (f*a - c*d) / (e*a - b*d)

    if x == -0.0:
        x = 0
    if y == -0.0:
        y = 0

    print "%.3f %.3f" % (x, y)

Submission status: Accepted

Solution code:
import sys

while True:
	line = sys.stdin.readline()
	if line is '':
		break
	
	(a, b, e, c, d, f) = map(float, line.split())
	
	D = a * d - b * c
	x = (d * e - b * f) / D
	y = (a * f - c * e) / D
	
	if abs(x) < 1e-4:
		x = 0.0
	if abs(y) < 1e-4:
		y = 0.0
	
	print("{0:.3f} {1:.3f}".format(x, y))

Submission status: Accepted

Solution code:
import sys

eps = float(pow(10,-7))

while (True):
    L = map(float, sys.stdin.readline().split())
    if L:
        (a, b, c, d, e, f) = L
        x = (e * c - b * f) / (a * e - b * d)
        y = (a * f - d * c) / (a * e - b * d)

        if (abs(x) < eps):
            x = 0.0
        if (abs(y) < eps):
            y = 0.0

        print "{0:.3f} {1:.3f}".format(x, y)

    else:
        break

Submission status: Accepted

Solution code:
while True:
    try:
        a, b, c, d, e, f = map(float, input().split())
        z = a * e - b * d
        x = (c * e - b * f) / z
        y = (a * f - c * d) / z
        print("{:.3f} {:.3f}".format(x + 0, y + 0))
    except:
        break

Submission status: Accepted

Solution code:
while True:
    try:
        a1,b1,c1,a2,b2,c2 = map(float,raw_input().split(' '))
        det = a1*b2-b1*a2
        x = (c1*b2-b1*c2)/det
        if not x:
            x = 0.
        y = (a1*c2-c1*a2)/det
        if not y:
            y = 0.
        print '{0:.3f} {1:.3f}'.format(x,y)
    except:
        break

Submission status: Accepted

Solution code:
import sys

x = 0
y = 0
while True:
    try:
	 a,b,c,d,e,f = map(float,raw_input().split())
	 if a == 0:
	     y = c / b
	     x = (f - e * c / b) / d
	 elif b == 0:
	     x = c / a
	     y = (f - d * c / a) / e
	 elif d == 0:
	     y = f / e
	     x = (c - b * f / e) / a
	 elif e == 0:
	     x = f / d
	     y = (c - a * f / d) / b
	 else:
	     x = (c*e - b*f) / (a*e - b*d)
	     y = (c*d - a*f) / (b*d - a*e)

         if x == 0:
	     x = 0.0
	 if y == 0:
	     y = 0.0
	 print "%.3f %.3f" % (x,y)

    except EOFError:
	break

Submission status: Accepted

Solution code:
while True:
    try:
        a,b,c,d,e,f = (int(i) for i in input().split())
        det=a*e-b*d
        x = (c*e-b*f)/det
        y = (a*f-c*d)/det
        if x==0:x=0
        if y==0:y=0
        print("{0:.3f} {1:.3f}".format(x,y))
    except EOFError:
        break

Submission status: Accepted

Solution code:
import sys
for l in sys.stdin:
    a,b,c,d,e,f=map(float,l.split())
    x=a*e-b*d
    print"%0.3f %0.3f"%(c*e/x-b*f/x,a*f/x-c*d/x)

Submission status: Accepted

Solution code:
import sys
lines = sys.stdin.readlines()
for line in lines:
    line = line.split(" ")
    inp = []
    for i in line:
        inp.append(int(i))
    a = inp[0]
    b = inp[1]
    c = inp[2]
    d = inp[3]
    e = inp[4]
    f = inp[5]
    delta = a*e - b*d
    x = (c*e-b*f)/delta
    if x==0.0:
        x = 0.0
    y = (-d*c+a*f)/delta
    if y==0.0:
        y = 0.0
    print("%.3f %.3f" % (x,y))

Submission status: Accepted

Solution code:
import sys

inputNum = sys.stdin.readlines()

for i in inputNum:
    new = []
    n = i[:-1].split(' ', 6)
    for s in n:
        new.append(float(s))
    k = new[0]
    q = 0
    for a in new[0:3]:
        new[q] = a/k
        q = q + 1
    l = new[3]
    for a in new[3:6]:
        new[q] = a - l*new[q-3]
        q = q + 1
    if new[4] == 0:
        y = new[5]
    else:
        y = new[5]/new[4]
    x = new[2]-(new[1]*y)
    print("{0:.3f}".format(x)+" "+"{0:.3f}".format(y))

Submission status: Accepted

Solution code:
import sys
for line in sys.stdin.readlines():
    a, b, c, d, e, f=map(float,line.split())
    k=(a*e)-(b*d)
    xval=(c*e)-(b*f)
    yval=(a*f)-(c*d)
    g=xval/k
    h=yval/k
    if(xval==0):
        g=0
    if(yval==0):
        h=0
    print("%.3f %.3f"%(g,h))

Submission status: Accepted

Solution code:
import sys
import time
#1.2 2.8 4.12 1.5 3.0 4.5
for line in sys.stdin:
    a1,b1,c1,a2,b2,c2 = map(float,line.split())
    i=0
    x = (c1*b2-c2*b1) / (a1*b2-a2*b1)
    y = (a1*c2-a2*c1) / (a1*b2-a2*b1)
    if "-0" in str(x):
        x = 0.0
    print "%.3f %.3f"%(x,y)

Submission status: Accepted

Solution code:
import sys

for line in sys.stdin:
    a, b, c, d, e, f = map(float, line.split())
    det = a*e-b*d    
    print '%.3f %.3f' % (round((c*e-b*f)/det, 3)+0.000001, round((a*f-c*d)/det, 3))

Submission status: Accepted

Solution code:
ar = []
while True:
  try:
    a, b, c, d, e, f = map(float, raw_input().split())
    x = (c * e - b * f) / (a * e - d * b)
    y = (c * d - f * a) / (b * d - e * a)
    ar.append([x, y])
  except:
    break

for i in ar:
  print("{:.3f} {:.3f}".format(i[0] + 0, i[1] + 0))

Submission status: Accepted

Solution code:
import sys

for line in sys.stdin:
    a, b, c, d, e, f = map(int, line.split())
    y = (c * d - a * f) / (b * d - a * e)
    x = (c - b * y) / a
    print('{0:.3f} {1:.3f}'.format(x, y))

Submission status: Accepted

Solution code:
import sys

for s in sys.stdin:
  a, b, c, d, e, f = map(float, s.split())
  y = (a*f - d*c)/(a*e - d*b)
  x = (c - b*y)/a
  print '%.03f %.03f'%(x, y)

Submission status: Accepted

Solution code:
import sys

ary=[]
ans=[]
def solve(a,b,c,d,e,f):
    if c*e-b*f==0:
        x=0
    else:
        x=(c*e-b*f)/(a*e-b*d)
    if c*d-a*f==0:
        y=0
    else:
        y=(c*d-a*f)/(b*d-a*e)
    return [x,y]

for i in sys.stdin:
    ary.append(list(map(int,i.split())))
    ans.append(solve(*ary[-1]))

for i in range(len(ans)):
    print('{0:.3f} {1:.3f}'.format(round(ans[i][0],3),round(ans[i][1],3)))

Submission status: Accepted

Solution code:
while(True):
        try:
            a,b,c,d,e,f=map(float,input().split(" "))
            z=a*e-b*d
            if(z!=0):
                x=(c*e-b*f)/z
                y=(a*f-c*d)/z
            print("{:.3f} {:.3f}".format(x+0,y+0))
        except:
            break

Submission status: Accepted

Solution code:
import math
def saidai(x, y):
    x, y = math.fabs(x), math.fabs(y)
    y, x = max(x, y), min(x, y)
    if x == 0:
        return y

    return saidai(x, y % x)

def saisyo(x, y):
    spam = saidai(x, y)
    return spam * (x / spam) * (y / spam)

# a,b,c,d,e,f  = list(map(int,'1 2 3 4 5 6'.split()))
try:
    while 1:

        a,b,c,d,e,f  = list(map(int,input().split()))
        s = saidai(a, d)

        k1 = d / s * -1
        k2 = a / s

        y = (k1*c + k2 * f) / (k1 * b + k2 * e)
        x = (c - b*y) / a
        print("{:.3f} {:.3f}".format(x, y))
except Exception:
    pass

Submission status: Accepted

Solution code:
import math
def gcd(x, y):
    x, y = math.fabs(x), math.fabs(y)
    y, x = max(x, y), min(x, y)
    if x == 0:
        return y

    return gcd(x, y % x)

try:
    while 1:

        a,b,c,d,e,f  = list(map(int,input().split()))
        s = gcd(a, d)

        k1 = d / s * -1
        k2 = a / s

        y = (k1*c + k2 * f) / (k1 * b + k2 * e)
        x = (c - b*y) / a
        print("{:.3f} {:.3f}".format(x, y))
except Exception:
    pass

Submission status: Accepted

Solution code:
try:
    while 1:

        a,b,c,d,e,f  = list(map(int,input().split()))
        y = (c * d - f * a) / (d * b - a * e)
        x = (c - b * y) / a

        print("{:.3f} {:.3f}".format(x, y))
except Exception:
    pass