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

Solution (Python):
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

Solution (Python):
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)

Solution (Python):
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))

Solution (Python):
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)

Solution (Python):
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

Solution (Python):
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]))

Solution (Python):
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

Solution (Python):





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

Solution (Python):
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))

Solution (Python):


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())
  
  main(lines)

Solution (Python):
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
        
        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

Solution (Python):
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;

Solution (Python):
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

Solution (Python):



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 )

Solution (Python):
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

Solution (Python):
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

Solution (Python):
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

Solution (Python):
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;

Solution (Python):
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)

Solution (Python):


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)

Solution (Python):
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)

Solution (Python):
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))

Solution (Python):
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

Solution (Python):
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

Solution (Python):

import sys


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


def Gauss(array):
    
    

    for r in range(len(array)):
        
        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]))

Solution (Python):
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 "%.3f %.3f" % (x,y)
    except EOFError:
        break

Solution (Python):


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

Solution (Python):
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)

Solution (Python):
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]

Solution (Python):
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

Solution (Python):
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)

Solution (Python):
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

Solution (Python):



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

Solution (Python):


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)

Solution (Python):


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 ) )

Solution (Python):


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 ) )

Solution (Python):
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))

Solution (Python):


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

Solution (Python):


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

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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()

Solution (Python):
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

Solution (Python):
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))

Solution (Python):
import sys

input_lines = sys.stdin.readlines()


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

lines = map(lambda x: x.split(" "), 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)

Solution (Python):
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))

Solution (Python):
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

Solution (Python):
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

Solution (Python):
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

Solution (Python):
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

Solution (Python):
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

Solution (Python):
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)

Solution (Python):
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))

Solution (Python):
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))

Solution (Python):
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))

Solution (Python):
import sys
import time

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)

Solution (Python):
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))

Solution (Python):
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))

Solution (Python):
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))

Solution (Python):
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)

Solution (Python):
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)))

Solution (Python):
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

Solution (Python):
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

Solution (Python):
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)


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

Solution (Python):
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

Solution (Python):
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

Solution (Python):
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

Solution (Python):
import sys
 
out = []
for line in sys.stdin.readlines():
    List = map(float, line.strip().split())
 
    [a, b, c, d, e, f] = List
 
    x = (b*f-c*e)/(b*d-a*e)
    y = (a*f-c*d)/(a*e-b*d)
 
    out.append("%.3f %.3f" % (x+0, y+0))
 
for i in xrange(len(out)):
    print out[i]

Solution (Python):
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

Solution (Python):


import sys

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

Solution (Python):
import sys

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

Solution (Python):
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

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

Solution (Python):
def get_input():
    while True:
        try:
            yield "".join(input())
        
        except EOFError:
            break

if __name__ == "__main__":
    array = list(get_input())
    for i in range(len(array)):
        temp_a,temp_b,temp_c,temp_d,temp_e,temp_f = array[i].split()
        
        a,b,c,d,e,f = int(temp_a),int(temp_b),int(temp_c),int(temp_d),int(temp_e),int(temp_f)
        
        if a!=0:
            if e-b*d/a !=0:
                y = (f-c*d/a)/(e-b*d/a)
                x = (c - b*y)/a
            else:
                print("cannot solve equation")
        else:
            if b!=0:
                y = c/b
                if d!=0:
                    x = (f -e*y)/d
                else:
                    print("cannot solve equation")
                
        
        print("{:.3f} {:.3f}".format(x,y))

Solution (Python):


def main():
	while True:
		try:
			form = [float(x) for x in input().split(" ")] 
		except:
			return
		else:
			if form[0] == 0:
				y = form[2] / form[1]
				x = (form[5] - y * form[4]) / form[3]
			else:
				b = form[1] / form[0]
				c = form[2] / form[0]
				e = form[4] - form[3] * b
				f = form[5] - form[3] * c
				y = f / e
				x = (form[2] - y * form[1]) / form[0] 
			print("{:.3f} {:.3f}".format(x,y))
			
if __name__ == '__main__':
  main()

Solution (Python):
import sys
dataset = sys.stdin.readlines()

for item in dataset:
    a, b, c, d, e, f = list(map(int, item.split()))

    y = (c * d - f * a)/(b * d - e * a)
    x = (c * e - b * f) / (a * e - b * d)
    if x == 0:
        x = 0
    print("{:.3f} {:.3f}".format(x, y))

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

Solution (Python):





def maru(f):
	if f>=0:
		sgn="+"
	else:
		sgn="-"
	f=abs(f)

	f*=1000
	f_int  =f-f%1
	f_float=f%1

	if f_float>=0.5:
		f_int+=1
	else:
		pass

	f=int(f_int)
	if f%1000==0:
		s="000"
	else:
		s=f%1000
	if sgn=="-":
		p="-"+str(f//1000)+"."+str(s)
	else:
		p=str(f//1000)+"."+str(s)
	return p








ans=[]
while True:
	try:
		a,b,c,d,e,f=list(map(float,input().split(" ")))
		if c*e-b*f==0:
			x=0
		else:
			x=(c*e-b*f)/(a*e-b*d)
		if a*f-c*d==0:
			y=0
		else:
			y=(a*f-c*d)/(a*e-b*d)
		ans.append(maru(x)+" "+maru(y))
	except:
		break

for i in ans:
	print(i)

Solution (Python):
while True:
  try:
    a, b, c, d, e, f = map(int, input(). split())
    D = (a * e) - (b * d)
    x = (e * c) - (b * f)
    y = (a * f) - (d * c)
    x /= D
    y /= D
    if x / D == 0:
      x = 0
    if y / D == 0:
      y = 0
    print("%.3f %.3f" % (round(x, 3), round(y, 3)))
  except:
    break

Solution (Python):
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)

    if x == -0.0:
      x = 0

    if y == -0.0:
      y = 0

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

  except EOFError:
    break

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

Solution (Python):
while True:
    try:
        a, b, c, d, e, f = [float(x) for x in input().split()]
    except:
        exit()
    m = [[a,b,c],[d,e,f]]
    row = len(m)
    col = len(m[0])
    for k in range(row):
        for j in range(k+1,col):
            m[k][j] /=m[k][k]
        for i in range(row):
            if(i != k):
                for j in range(k+1,col):
                    m[i][j] -= m[i][k] * m[k][j]
    print ("%.3f %.3f" % (m[0][2],m[1][2]))

Solution (Python):
def Cramer(coef):
	deno = coef[0]*coef[4] - coef[1]*coef[3]
	return [(coef[2]*coef[4] - coef[1]*coef[5]) / deno, (coef[0]*coef[5] - coef[2]*coef[3]) / deno]

while True:
	try:
		coeflist = [float(item) for item in input().split()]
		ans1, ans2 = Cramer(coeflist)
		if abs(ans1) < 1e-4:
			ans1 = 0.0
		if abs(ans2) < 1e-4:
			ans2 = 0.0
		print('%.3f %.3f' %(ans1, ans2))
	except EOFError:
		break

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

Solution (Python):
import sys

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

Solution (Python):



import sys

def inverse(a, b, d, e):
    deta = a * e - b * d
    return (deta, e, -b, -d, a)

while True:
    data = sys.stdin.readline()
    if data is None or data.strip() == '':
        break
    data = data.strip().split(' ')
    a, b, c, d, e, f = [float(i) for i in data]

    inv = inverse(a, b, d, e)
    x = (inv[1] * c + inv[2] * f) / inv[0] + 0
    y = (inv[3] * c + inv[4] * f) / inv[0] + 0

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

Solution (Python):
import sys

for line in sys.stdin:
    array = [float(x) for x in line.split()]
    ar1 = array[0:3]
    ar2 = array[3:]
    i = ar1[0]
    ar1 = [x*ar2[0] for x in ar1]
    ar2 = [x*i for x in ar2]
    y = (ar1[2] - ar2[2])/(ar1[1]-ar2[1])
    ar1 = array[0:3]
    x = (ar1[2]-ar1[1]*y)/ar1[0]
    print('%.3f %.3f' % (round(x,3), round(y,3)))

Solution (Python):
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)

Solution (Python):
from sys import stdin

def deal(x):
    if abs(x) < 1e-6: return 0
    else: return x

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

for s in stdin:
    s = s[:-1]
    s = map(float, s.split())
    p = solve(s[0], s[1], s[2], s[3], s[4], s[5])
    print ("%.3f "%p[0] + "%.3f"%p[1])

Solution (Python):
import sys

for line in sys.stdin:
    a, b, e, c, d, f = map(int, line.split())
    det = a * d - b * c
    a11 = d / det
    a12 = - b / det
    a21 = - c / det
    a22 = a / det
    print("%.3f %.3f" % (round(a11 * e + a12 * f, 3), round(a21 * e + a22 * f, 3)))

Solution (Python):
import sys
L = sys.stdin.readlines()
for line in L:
	A = line.split()
	a, b, c, d, e, f = [float(A[i]) for i in range(6)]
	x = (b * f - c * e) / (b * d - a * e)
	y = (c * d - a * f) / (b * d - a * e)
	print("{:.3f} {:.3f}".format(x+0, y+0))