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: Runtime Error

Solution code:
# Vol0004.
import sys

def main():
    data = []
    lines = sys.stdin.readlines()
    fp.close()

    for line in lines:
        data.append(line.split())  # スペース区切りで放り込む
    # ax + by = c, dx + ey = fの解は、
    # x = (ce - bf) / (ae - bd), y = (af - cd) / (ae - bd).
    # これをround(float, 3)すれば答えが出る。
    N = len(data)
    for i in range(N):
        for k in range(6):
            data[i][k] = int(data[i][k])
        det = data[i][0] * data[i][4] - data[i][1] * data[i][3]
        gx = data[i][2] * data[i][4] - data[i][1] * data[i][5]
        gy = data[i][0] * data[i][5] - data[i][2] * data[i][3]
        if det < 0:
            det = -det;
            if gx != 0: gx = -gx
            if gy != 0: gy = -gy
        print("{0:.3f}".format(gx / det) + " " + "{0:.3f}".format(gy / det))

if __name__ == "__main__":
    main()

# 補足、0.1とか0.22でも3桁目まで表示しないとWrongになる。
# 表示するにはprint("{0:.nf}".format(数))ってやる(nのところは桁数)。
# さらに、0を負の数で割ると表示が-0.000になってしまうのでそこの処理も重要。

Submission status: Runtime Error

Solution code:

def ans(a, b, c, d, e, f):
    x = ((e*c - b*f)/(a*e-b*d))
    y = ((-d*x + f)/e)
    x = "%.3f" % x
    y = "%.3f" % y
    return x, y


sets = []

while True:
    try:
        line = list(map(int, input().split()))
        if(line[0] == " "):
            break;
        else:
            sets.append(line)
    except IndexError:
        break

for i in sets:
    x, y = ans(i[0],i[1],i[2],i[3],i[4],i[5])
    print(x, y)

Submission status: Runtime Error

Solution code:
def ans(a, b, c, d, e, f):
    x = ((e*c - b*f)/(a*e-b*d))
    y = ((-d*x + f)/e)
    x = "%.3f" % x
    y = "%.3f" % y
    return x, y


sets = []

while True:
    try:
        line = list(map(int, input().split()))
        if(line[0] == " "):
            break;
        else:
            sets.append(line)
    except IndexError:
        break

for i in sets:
    x, y = ans(i[0],i[1],i[2],i[3],i[4],i[5])
    print(x, y)

Submission status: Runtime Error

Solution code:
while True:
  try:
    q = map(int,raw_input().split(" "))
    y = (-1*q[0]*q[5] + q[2] * q[3]) / (-1*q[0] * q[4] + q[1] * q[3])
    x = (q[5]-q[4]* y)/ q[3]

    if x == -0 or  y == -0 : 
      x == 0   
      y == 0
    print "%.3f %.3f" % (x,y)
  except EOFError:
    break

Submission status: Runtime Error

Solution code:
import sys
for x in sys.stdin.readlines():
    n = [int(y) for y in x.split()]

    print "%.3f %.3f" % ((n[2]*n[4]-n[1]*n[5])/(n[0]*n[3]-n[1]*n[3]),(n[5]*n[0]-n[2]*n[3])/(n[0]*n[4]-n[3]*n[1]))

Submission status: Runtime Error

Solution code:
while True:
    a = map(float, raw_input().split(' '))
    if a[1]*a[3]-a[0]*a[4] == 0:
        print 'No answer'
    else:
        x = (a[1]*a[5]-a[2]*a[4])/(a[1]*a[3]-a[0]*a[4])
        y = (a[2]*a[3]-a[0]*a[5])/(a[1]*a[3]-a[0]*a[4])
        print '%.3f %.3f ' % (x,y)

Submission status: Runtime Error

Solution code:
while True:
    a = map(float, raw_input().split(' '))
    if a[1]*a[3]-a[0]*a[4] == 0:
        print 'No answer'
    else:
        x = (a[1]*a[5]-a[2]*a[4])/(a[1]*a[3]-a[0]*a[4])
        y = (a[2]*a[3]-a[0]*a[5])/(a[1]*a[3]-a[0]*a[4])
        if x == 0:
            x = abs(x)
        if y == 0:
            y = abs(y)
        print '%.3f %.3f ' % (x,y)

Submission status: Runtime Error

Solution code:
while True:
    a = map(float, raw_input().split(' '))
    x = (a[1]*a[5]-a[2]*a[4])/(a[1]*a[3]-a[0]*a[4])
    y = (a[2]*a[3]-a[0]*a[5])/(a[1]*a[3]-a[0]*a[4])
    if x == 0:
        x = abs(x)
    if y == 0:
        y = abs(y)
    print '%.3f %.3f ' % (x,y)

Submission status: Runtime Error

Solution code:
x = map(int,input().split(' '))
a = x[0]
b = x[1]
c = x[2]
d = x[3]
e = x[4]
f = x[5]
print round((c*e-b*f)/(a*e-d*b),4),round((c*d-a*f)/(b*d-a*e),4)

Submission status: Runtime Error

Solution code:
x = map(float,input().split(' '))
a = x[0]
b = x[1]
c = x[2]
d = x[3]
e = x[4]
f = x[5]
print round((c*e-b*f)/(a*e-d*b),4),round((c*d-a*f)/(b*d-a*e),4)

Submission status: Runtime Error

Solution code:
x = map(float,input().split(' '))
a = x[0]
b = x[1]
c = x[2]
d = x[3]
e = x[4]
f = x[5]
g = (c*e-b*f)/(a*e-d*b)
h = (c*d-a*f)/(b*d-a*e)
print round(g,4),round(h,4)

Submission status: Runtime Error

Solution code:
x = map(float,input().split(' '))
a = x[0]
b = x[1]
c = x[2]
d = x[3]
e = x[4]
f = x[5]
g = (c*e-b*f)/(a*e-d*b)
h = (c*d-a*f)/(b*d-a*e)
print round(g,3),round(h,3)

Submission status: Runtime Error

Solution code:
data = []
try:
    while True:
        data.append(raw_input())

except EOFError:
        pass

for i in data:
    a, b, c, d, e, f = i.split()
    a, b, c, d, e, f = int(a), int(b), int(c), int(d), int(e), int(f)
    if abs(a) or abs(b) or abs(c) or abs(d) or abs(e) or abs(f) <= 1000:
        for j in range(-1000, 1001):
            if j != 0:
                y1 = (c - (a*j)) / float(b)
                y2 = (f - (d*j)) / float(e)
                if y1 == y2: 
                    print "{:.4f} {:.4f}".format(j, y1) 
                    break

Submission status: Runtime Error

Solution code:
data = []
try:
    while True:
        data.append(raw_input())

except EOFError:
        pass

for i in data:
    a, b, c, d, e, f = i.split()
    a, b, c, d, e, f = int(a), int(b), int(c), int(d), int(e), int(f)
    if abs(a) or abs(b) or abs(c) or abs(d) or abs(e) or abs(f) <= 1000:
        for j in range(-1000, 1001):
            if j != 0:
                y1 = (c - (a*j)) / float(b)
                y2 = (f - (d*j)) / float(e)
                if y1 == y2:
                    print "{:.3f} {:.3f}".format(j, y1)
                    break

Submission status: Runtime Error

Solution code:
data = []
try:
    while True:
        data.append(raw_input())

except EOFError:
        pass

for i in data:
    a, b, c, d, e, f = i.split()
    a, b, c, d, e, f = int(a), int(b), int(c), int(d), int(e), int(f)
    if abs(a) or abs(b) or abs(c) or abs(d) or abs(e) or abs(f) <= 1000:
        for j in range(-1000, 1001):
            if j != 0:
                y1 = (c - (a * j)) / float(b)
                y2 = (f - (d * j)) / float(e)
                if y1 == y2:
                    print "{:.3f} {:.3f}".format(j, y1)
                    break

Submission status: Runtime Error

Solution code:
data = []
try:
    while True:
        data.append(raw_input())

except EOFError:
        pass

for i in data:
    a, b, c, d, e, f = i.split()
    a, b, c, d, e, f = int(a), int(b), int(c), int(d), int(e), int(f)
    if abs(a) or abs(b) or abs(c) or abs(d) or abs(e) or abs(f) <= 1000:
        for j in range(-1000, 1001):
            if j != 0:
                if (c - (a * j)) / float(b) == (f - (d * j)) / float(e):
                    print "{:.3f} {:.3f}".format(j, (c - (a * j)) / float(b))
                    break

Submission status: Runtime Error

Solution code:
data = []
try:
    while True:
        data.append(raw_input())

except EOFError:
        pass

for i in data:
    a, b, c, d, e, f = i.split()
    a, b, c, d, e, f = int(a), int(b), int(c), int(d), int(e), int(f)
    if abs(a) or abs(b) or abs(c) or abs(d) or abs(e) or abs(f) <= 1000:
        for j in range(-1000, 1001):
            y1 = (c - (a * j)) / float(b)
            y2 = (f - (d * j)) / float(e)
            if y1 == y2:
                print "{:.3f} {:.3f}".format(j, y1)
                break

Submission status: Runtime Error

Solution code:
data = []
try:
    while True:
        data.append(raw_input())

except EOFError:
        pass

for i in data:
    a, b, c, d, e, f = i.split()
    a, b, c, d, e, f = int(a), int(b), int(c), int(d), int(e), int(f)
    if (abs(a) <= 1000
        and abs(b) <= 1000
        and abs(c) <= 1000
        and abs(d) <= 1000
        and abs(e) <= 1000
        and abs(f) <= 1000):
        for j in range(-1000, 1001):
            y1 = (c - (a * j)) / float(b)
            y2 = (f - (d * j)) / float(e)
            if y1 == y2:
                print "{:.3f} {:.3f}".format(j, y1)
                break

Submission status: Runtime Error

Solution code:
e True:
    try:
        a = map(long,raw_input().split())
        m = a[0]*a[4]-a[1]*a[3]

        x = (a[4]*a[2] - a[1]*a[5])/m
        y = (a[0]*a[5] - a[2]*a[3])/m

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

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

    except EOFError:
	break

Submission status: Runtime Error

Solution code:

import sys


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


lis = sys.stdin.readlines()
for line in lis:
    a, b, c, d, e, f = tuple(map((lambda x: float(x)), line.split(' ')))
    (x, y) = solv(a, b, c, d, e, f)
    print "%5.3f %5.3f" % (x, y)

Submission status: Runtime Error

Solution code:

import sys


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


lis = sys.stdin.readlines()
for line in lis:
    a, b, c, d, e, f = tuple(map(float, line.split(' ')))
    (x, y) = solv(a, b, c, d, e, f)
    print "%5.3f %5.3f" % (x, y)

Submission status: Runtime Error

Solution code:
import sys
 
 
def gcd(a, b):
    return gcd(b, a % b) if a % b else b
 
 
def lcm(a, b):
    return a * b / gcd(a, b)
 
for line in sys.stdin:
    data = map(int, line.split())
    a, b, c, d, e, f = data
    ix = lcm(a, d) / a
    jx = lcm(a, d) / d
    iy = lcm(b, e) / b
    jy = lcm(b, e) / e
    x = (c*1.0*iy - f*jy) / (a*iy - d*jy)
    y = (c*1.0*ix - f*jx) / (b*ix - e*jx)
    print "%.3f %.3f" % (round(x, 4), round(y, 4))

Submission status: Runtime Error

Solution code:
import sys


def gcd(a, b):
    return gcd(b, a % b) if a % b else b


def lcm(a, b):
    return a * b / gcd(a, b)

for line in sys.stdin:
    data = line.split()
    a, b, c, d, e, f = data
    ix = lcm(a, d) / a
    jx = lcm(a, d) / d
    iy = lcm(b, e) / b
    jy = lcm(b, e) / e
    x = (c*1.0*iy - f*jy) / (a*iy - d*jy)
    y = (c*1.0*ix - f*jx) / (b*ix - e*jx)
    print "%.3f %.3f" % (round(x, 4), round(y, 4))

Submission status: Runtime Error

Solution code:
import sys


def gcd(aa, bb):
    return gcd(bb, aa % bb) if aa % bb else bb


def lcm(aa, bb):
    return aa * bb / gcd(aa, bb)

for line in sys.stdin:
    data = line.split()
    a, b, c, d, e, f = data
    ix = lcm(a, d) / a
    jx = lcm(a, d) / d
    iy = lcm(b, e) / b
    jy = lcm(b, e) / e
    x = (c*1.0*iy - f*jy) / (a*iy - d*jy)
    y = (c*1.0*ix - f*jx) / (b*ix - e*jx)
    print "%.3f %.3f" % (round(x, 4), round(y, 4))

Submission status: Runtime Error

Solution code:
import sys


def gcd(a, b):
    return gcd(b, a % b) if a % b else b


def lcm(a, b):
    return a * b / gcd(a, b)

for line in sys.stdin:
    data = map(int, line.split())
    a, b, c, d, e, f = data
    ix = lcm(a, d) / a
    jx = lcm(a, d) / d
    iy = lcm(b, e) / b
    jy = lcm(b, e) / e
    x = (c*1.0*iy - f*jy) / (a*iy - d*jy)
    y = (c*1.0*ix - f*jx) / (b*ix - e*jx)
    print "%.3f %.3f" % (round(x, 4), round(y, 4))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
while 1:
        P = map(float,raw_input().split())
        x = (P[2]*P[4]-P[1]*P[5])/(P[0]*P[4]-P[1]*P[3])
        y = (P[2]*P[3]-P[0]*P[5])/(P[1]*P[3]-P[0]*P[4])
        x = x if x else 0
        y = y if y else 0
        print "{:.3f} {:.3f}".format(x,y)

Submission status: Runtime Error

Solution code:
data = raw_input()
while data:
    a, b, c, d, e, f = map(int, data.split())
    det = a*e-b*d
    x, y = float(e*c+(-b)*f)/det, float((-d)*c+a*f)/det
    print '%.3f %.3f' % (x, y)
    data = raw_input()

Submission status: Runtime Error

Solution code:
while True:
	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)
	 
	print ("{0:.3f} {1:.3f}".format(x + 0, y + 0))

Submission status: Runtime Error

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(c*d - a*f)/(b*d - a*e)
        print ("%f %f" % (round(x,-3), round(y,-3))
    except:
        break

Submission status: Runtime Error

Solution code:
import sys
for i in stdin.sys:
    a, b, c, d, e, f = map(float, raw_input().split()) 
    x = float(c*e - b*f)/(a*e - b*d)
    y = float(c*d - a*f)/(b*d - a*e)
    if x == -0:
        x = 0
    if y == -0:
        y = 0
    print ("%.3f %.3f" % (x, y))

Submission status: Runtime Error

Solution code:
while 1:
  a, b, c, d, e, f = map(int, raw_input().split())
  g = b / e
  x = (c - g * f) / (a - g)
  y = (c - a * x) / b
  print str(x) + " " + str(y)

Submission status: Runtime Error

Solution code:
while 1:
  a, b, c, d, e, f = map(int, raw_input().split())
  g = b / e
  x = (c - g * f) / (float(a) - g)
  y = (c - a * x) / float(b)
  print str(x) + " " + str(y)

Submission status: Runtime Error

Solution code:
import sys

while 1:
  try:
    a, b, c, d, e, f = map(int, raw_input().split())
    g = b / e
    x = (c - g * f) / (float(a) - g)
    y = (c - a * x) / float(b)
    print str(x) + " " + str(y)
  except: EOFError
    sys.exit()

Submission status: Runtime Error

Solution code:
import sys

while 1:
  try:
    a, b, c, d, e, f = map(int, raw_input().split())
    g = b / e
    x = (c - g * f) / (float(a) - g)
    y = (c - a * x) / float(b)
    print str(x) + " " + str(y)
  exception: EOFError
    sys.exit()

Submission status: Runtime Error

Solution code:
import sys

while 1:
  try:
    a, b, c, d, e, f = map(int, raw_input().split())
    g = b / e
    x = (c - g * f) / (float(a) - g)
    y = (c - a * x) / float(b)
    print str(x) + " " + str(y)
  except EOFError:
    sys.exit()

Submission status: Runtime Error

Solution code:
while 1:
  try:
    a, b, c, d, e, f = map(int, raw_input().split())
    g = b / e
    x = (c - g * f) / (float(a) - g)
    y = (c - a * x) / float(b)
    print str(x) + " " + str(y)
  except EOFError:
    break

Submission status: Runtime Error

Solution code:
while 1:
  try:
    a, b, c, d, e, f = map(float, raw_input().split())
    g = b / e
    x = (c - g * f) / a - g)
    y = (c - a * x) / b
    print str(x) + " " + str(y) + "\n"
  except:
    break

Submission status: Runtime Error

Solution code:
while 1:
  try:
    a, b, c, d, e, f = map(int, raw_input().split())
    g = float(b) / float(e)
    float(x) = (c - g * f) / (a - g)
    float(y) = (c - a * x) / b
    print str(x) + " " + str(y) + "\n"
  except:
    break

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
while True:
	line = raw_input()
	if not line: break;
	
	lines = [int(x) for x in line.split(" ")]
	if lines.length == 6:
		x = 0
		y = 0
		(A1, B1, E1, A2, B2, E2) = lines
		if A1*B2==B1*A2 or A1*B2-A2*B1:
			break;
		x=1000*(E1*B2-B1*E2)/(A1*B2-B1*A2)
		y=1000*(E2*A1-E1*A2)/(A1*B2-A2*B1)
		
		print "%.3f %.3f" % (round(x)/1000, round(y)/1000)

Submission status: Runtime Error

Solution code:
while True:
	a,b,e,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 '%d %d' % (x,y)

Submission status: Runtime Error

Solution code:
while True:
	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)

Submission status: Runtime Error

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)
		if x == -0.0:
			x = 0
		if y == -0.0
			y = 0
		print '%.3f %.3f' % (x,y)
	except EOFError:
		break

Submission status: Runtime Error

Solution code:
x=(e*d-b*f)/(a*d-b*c)
y=(-e*c+a*f)/(a*d-b*c)

print x

print y

Submission status: WA: Presentation Error

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


class Matrix():
    def __init__(self, A):
        self.A = A
        self.row = len(A)
        self.col = len(A[0])

    def __iter__(self):
        return self.A.__iter__()

    def __getitem__(self, i):
        return self.A.__getitem__(i)

    def __add__(self, B):
        aa = self.A
        bb = B.A
        return Matrix([[aa[i][j] + bb[i][j] for j in range(self.col)] for i in range(self.row)])

    def __sub__(self, B):
        aa = self.A
        bb = B.A
        return Matrix([[aa[i][j] - bb[i][j] for j in range(self.col)] for i in range(self.row)])

    def __mul__(self, B):
        aa = self.A
        bb = B.A
        a = []
        for i in range(self.row):
            ai = aa[i]
            r = []
            for j in range(B.col):
                r.append(sum([ai[k] * bb[k][j] for k in range(self.col)]))
            a.append(r)
        return Matrix(a)

    def __truediv__(self, x):
        pass

    def lu(self):
        # squaren??????
        size = self.row
        T = copy.deepcopy(self.A)
        L = [[0]*size for _ in range(size)]
        U = [[0]*size for _ in range(size)]
        for i in range(size):
            for j in range(i,size):
                L[j][i] = T[j][i]
            for j in range(i,size):
                U[i][j] = T[i][j] / T[i][i]
            for j in range(i+1,size):
                for k in range(i+1,size):
                    T[j][k] -= L[j][i] * U[i][k]

        return Matrix(L),Matrix(U)

    def __str__(self):
        return self.A.__str__()

# ??£???????¨????????§£???
def solve_se(A, b):
    n = A.row
    L,U = A.lu()
    y = []
    for i in range(n):
        t = b[i]
        for k in range(i):
            t -= L[i][k] * y[k]
        y.append(t / L[i][i])

    x = [0] * n
    for i in range(n-1,-1,-1):
        t = y[i]
        for k in range(i+1,n):
            t -= U[i][k] * x[k]
        x[i] = t
    return x


def main():
    sa = [s for s in sys.stdin.read().split('\n') if s]
    r = []
    for s in sa:
        a,b,c,d,e,f = [int(c) for c in s.split()]
        A = Matrix([[a,b],[d,e]])
        B = [c,f]
        x = solve_se(A,B)
        r.append(' '.join(map(lambda t: '{:01.3f}'.format(t), x)))

    return '\n'.join(r) + '\n'

print(main())

Submission status: WA: Presentation Error

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


class Matrix():
    def __init__(self, A):
        self.A = A
        self.row = len(A)
        self.col = len(A[0])

    def __iter__(self):
        return self.A.__iter__()

    def __getitem__(self, i):
        return self.A.__getitem__(i)

    def __add__(self, B):
        aa = self.A
        bb = B.A
        return Matrix([[aa[i][j] + bb[i][j] for j in range(self.col)] for i in range(self.row)])

    def __sub__(self, B):
        aa = self.A
        bb = B.A
        return Matrix([[aa[i][j] - bb[i][j] for j in range(self.col)] for i in range(self.row)])

    def __mul__(self, B):
        aa = self.A
        bb = B.A
        a = []
        for i in range(self.row):
            ai = aa[i]
            r = []
            for j in range(B.col):
                r.append(sum([ai[k] * bb[k][j] for k in range(self.col)]))
            a.append(r)
        return Matrix(a)

    def __truediv__(self, x):
        pass

    def lu(self):
        size = self.row
        T = copy.deepcopy(self.A)
        L = [[0]*size for _ in range(size)]
        U = [[0]*size for _ in range(size)]
        for i in range(size):
            for j in range(i,size):
                L[j][i] = T[j][i]
            for j in range(i,size):
                U[i][j] = T[i][j] / T[i][i]
            for j in range(i+1,size):
                for k in range(i+1,size):
                    T[j][k] -= L[j][i] * U[i][k]

        return Matrix(L),Matrix(U)

    def __str__(self):
        return self.A.__str__()

def solve_se(A, b):
    n = A.row
    L,U = A.lu()
    y = []
    for i in range(n):
        t = b[i]
        for k in range(i):
            t -= L[i][k] * y[k]
        y.append(t / L[i][i])

    x = [0] * n
    for i in range(n-1,-1,-1):
        t = y[i]
        for k in range(i+1,n):
            t -= U[i][k] * x[k]
        x[i] = t
    return x


def main():
    sa = [s for s in sys.stdin.read().split('\n') if s]
    r = []
    for s in sa:
        a,b,c,d,e,f = [int(c) for c in s.split()]
        A = Matrix([[a,b],[d,e]])
        B = [c,f]
        x = solve_se(A,B)
        r.append(' '.join(map(lambda t: '{:01.3f}'.format(t), x)))

    return '\n'.join(r) + '\n'

print(main())

Submission status: WA: Presentation Error

Solution code:
import sys
import math

r = sys.stdin.readlines()

#r.pop(0)

n = [[int(i) for i in (j.split())] for j in r] #n is list of each lines

for l in n:
    y = (l[2]*l[3]-l[0]*l[5])/(l[1]*l[3]-l[0]*l[4])
    
    x = (l[2]-l[1]*y)/l[0]
    
    print("{:.3f} {:.3f} ".format(x,y))

Submission status: WA: Presentation Error

Solution code:
import sys
import math

r = sys.stdin.readlines()



n = [[int(i) for i in (j.split())] for j in r] #n is list of each lines

for l in n:
    y = (l[2]*l[3]-l[0]*l[5])/(l[1]*l[3]-l[0]*l[4])
    
    x = (l[2]-l[1]*y)/l[0]
    
    print("{:.3f} {:.3f} ".format(x,y))

Submission status: WA: Presentation Error

Solution code:
t = 0
while t == 0:	
	try:
		a,b,e,c,d,f = [int(i) for i in input().split()]
	except:
		break
	else:
		x = (d*e - b*f) / (a*d - b*c) + 0
		y = (a*f - c*e) / (a*d - b*c) + 0
		print("{0:.3f}".format(x) + "  " + "{0:.3f}".format(y))

Submission status: WA: Presentation Error

Solution code:
while True:
    try:
        a = map(float, raw_input().split(' '))
        if a[1]*a[3]-a[0]*a[4] == 0:
            print 'No answer'
        else:
            x = (a[1]*a[5]-a[2]*a[4])/(a[1]*a[3]-a[0]*a[4])
            y = (a[2]*a[3]-a[0]*a[5])/(a[1]*a[3]-a[0]*a[4])
            if x == 0:
                x = abs(x)
            if y == 0:
                y = abs(y)
            print '%.3f %.3f ' % (x,y)
    except EOFError:
        break

Submission status: WA: Presentation Error

Solution code:
while True:
    try:
        a = map(float, raw_input().split(' '))
        x = (a[1]*a[5]-a[2]*a[4])/(a[1]*a[3]-a[0]*a[4])
        y = (a[2]*a[3]-a[0]*a[5])/(a[1]*a[3]-a[0]*a[4])
        if x == 0: 
            x = abs(x)
        if y == 0:
            y = abs(y)
        print '%.3f %.3f ' % (x,y)
    except EOFError:
        break

Submission status: WA: Presentation Error

Solution code:
while True:
    try:
        a = map(float, raw_input().split(' '))
        x = (a[1]*a[5]-a[2]*a[4])/(a[1]*a[3]-a[0]*a[4])
        y = (a[2]*a[3]-a[0]*a[5])/(a[1]*a[3]-a[0]*a[4])
        if x == 0: 
            x = 0
        if y == 0:
            y = 0
        print '%.3f %.3f ' % (x,y)
    except EOFError:
        break

Submission status: WA: Presentation Error

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