submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s919593081
p00004
Accepted
while True: try: (a,b,c,d,e,f) = map(float, raw_input().split()) y = (a * f - c * d) / (-b * d + e * a) x = (c - b * y) / a print '{0:.3f} {1:.3f}'.format(x, y) except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s014526561
p00004
Accepted
while True: try: a,b,c,d,e,f=map(float,raw_input().split()) y=(d*c-a*f)*1.0/(d*b-a*e) print "%.3f %.3f"%((c-b*y)/a,y) except:break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s219549134
p00004
Accepted
# Simultaneous Equation import sys datas = [] for line in sys.stdin: datas.append(map(float, line.split())) for data in datas: a, b, c, d, e, f = data y = (c * d - a * f) / (b * d - a * e) x = (c - b * y) / a print "{0:.3f} {1:.3f}".format(x, y)
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s772911992
p00004
Accepted
while 1: try: P = map(float,raw_input().split()) except EOFError: break x = (P[2]*P[4]-P[5]*P[1])/(P[0]*P[4]-P[3]*P[1]) y = (P[2]*P[3]-P[5]*P[0])/(P[1]*P[3]-P[4]*P[0]) x = x if x else 0 y = y if y else 0 print "{:.3f} {:.3f}".format(x,y)
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s625917704
p00004
Accepted
#!/usr/bin/env python get_y = lambda a,b,c,d,e,f: (f-(c*d/a)) / (e-(b*d/a)) get_x = lambda a,b,c,y: (c-b*y)/a if __name__ == "__main__": while True: try: a,b,c,d,e,f = [float(z) for z in raw_input().split()] y = get_y(a,b,c,d,e,f) x = get_x(a,b,c,y) print "%.3f %.3f" % (x, y) except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s525547073
p00004
Accepted
import sys for s in sys.stdin: a,b,c,d,e,f=map(float,s.split()) x=c*e-b*f y=a*f-c*d z=a*e-b*d def f(x,z): if x==0: return 0 else: return x/z print "%.3f %.3f" %(f(x,z),f(y,z))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s139495287
p00004
Accepted
import sys for s in sys.stdin: a,b,c,d,e,f=map(int,s.split()) x=c*e-b*f y=a*f-c*d z=a*e-b*d def f(x,z): if x==0: return 0 else: return 1.0*x/z print "%.3f %.3f" %(f(x,z),f(y,z))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s389288947
p00004
Accepted
import sys for s in sys.stdin: a,b,c,d,e,f=map(int,s.split()) y=(a*f-c*d)*1.0/(a*e-b*d) x=(c-b*y)/a print "%.3f %.3f" %(x,y)
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s650471276
p00004
Accepted
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: break for i in z: print("{:.3f} {:.3f}".format(i[0] + 0, i[1] + 0))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s693025860
p00004
Accepted
import sys for s in sys.stdin: a,b,c,d,e,f=map(float,s.split()) y=(a*f-c*d)/(a*e-b*d) print "%.3f %.3f"%((c-b*y)/a,y)
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s973410723
p00004
Accepted
# -*- coding: utf-8 -*- import sys outList = [] 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) outList.append("%.3f %.3f" % (x+0, y+0)) for i in xrange(len(outList)): print outList[i]
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s920864625
p00004
Accepted
while True: try: a,b,c,d,e,f=map(float,raw_input().split()) y=(d*c-a*f)*1.0/(d*b-a*e) print "%.3f %.3f" % ((c-b*y)/a, y) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s925201493
p00004
Accepted
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) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s498558737
p00004
Accepted
while 1: try: a, b, c, d, e, f = map(float, raw_input().split()) matrix = [[a, b, c], [d, e, f]] for i in range(2): tmp = matrix[i][i] for j in range(3): matrix[i][j] = matrix[i][j] / tmp for j in range(2): if i == j: continue else: a = matrix[j][i] for k in range(i, 3): matrix[j][k] = matrix[j][k] - a * matrix[i][k] print "%.3f %.3f" % (matrix[0][2], matrix[1][2]) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s319318111
p00004
Accepted
def gauss(matrix): dimension = len(matrix) for i in range(dimension): tmp = matrix[i][i] for j in range(dimension + 1): matrix[i][j] /= tmp for j in range(dimension): if i == j: continue else: tmp2 = matrix[j][i] for k in range(i, dimension + 1): matrix[j][k] -= tmp2 * matrix[i][k] return zip(*matrix)[-1] while 1: try: a, b, c, d, e, f = map(float, raw_input().split()) matrix = [[a, b, c], [d, e, f]] print "%.3f %.3f" % gauss(matrix) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s099525176
p00004
Accepted
while 2>1: try: a,b,c,d,e,f = map(float, raw_input().split(" ")) x=(c*e-b*f)/(e*a-b*d) y=(c*d-a*f)/(b*d-e*a) print "%.3f %.3f" % (x+0,y+0) except EOFError: break except ValueError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s221665741
p00004
Accepted
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
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s267049665
p00004
Accepted
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 if x: x = x / z y = a * f - c * d if y: y = y / z print('{:.3f} {:.3f}'.format(x, y))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s537265367
p00004
Accepted
import sys import math def readdata(): for line in sys.stdin: yield map(int,line.split()) def rounder(decimal): rounded = round(decimal*1000)/1000 if rounded == -0.0: rounded = +0.0 return rounded for data in readdata(): [a,b,c,d,e,f] = map(float,data) det = a*e-b*d x = (c*e-b*f)/det y = (a*f-c*d)/det [x,y] = map(rounder,[x,y]) print "%1.3f %1.3f" % (x,y)
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s487865562
p00004
Accepted
while True: try: a,b,c,d,e,f = (float(x) for x in input().split()) x = (c * e - b * f) / (a * e - b * d) y = (c * d - a * f) / (b * d - a * e) if x == 0: x = 0 if y == 0: y = 0 print(format(x, ".3f"), format(y, ".3f")) except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s050451285
p00004
Accepted
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) if x==-0: x=0 if y==-0: y=0 print(f"{x:.3f} {y:.3f}") except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s277430693
p00004
Accepted
while True: try: a,b,c,d,e,f = map(int,input().split()) y = (c*d-a*f)/(b*d-a*e) x = (c-b*y)/a print('{:.3f} {:.3f}'.format(x,y)) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s358187154
p00004
Accepted
while True: try: a, b, c, d, e, f = map(int, input().split()) except EOFError: break print(format(round((c*e-b*f)/(a*e-b*d)+0.,3), ".3f"), format(round((a*f-c*d)/(a*e-b*d)+0.,3), ".3f"), sep=" ")
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s218974148
p00004
Accepted
# coding: utf-8 # Your code here! b=0.0001 while True: try: a=list(map(float,input().split())) x=(a[2]*a[4]-a[1]*a[5])/(a[0]*a[4]-a[1]*a[3]) y=(a[2]*a[3]-a[0]*a[5])/(a[1]*a[3]-a[0]*a[4]) print("{0:.3f} {1:.03f}".format(x+b,y+b)) except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s774152966
p00004
Accepted
while True: try: L=list(map(int,input().split())) x=L[0]*L[4]-L[3]*L[1] y=L[2]*L[4]-L[5]*L[1] z=y/x+0 w=(L[2]-L[0]*z)/L[1]+0 print(f"{z:.3f} {w:.3f}") except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s207309778
p00004
Accepted
# coding: utf-8 # Your code here! while True: try: a, b, c, d, e, f = map(float, input().split()) x = (c * e - b * f) / (a * e - b * d) y = (c - a * x) / b if x == 0: print('{:.3f}'.format(abs(x)), '{:.3f}'.format(y)) elif y == 0: print('{:.3f}'.format(x), '{:.3f}'.format(abs(y))) else: print('{:.3f}'.format(x), '{:.3f}'.format(y)) except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s622689025
p00004
Accepted
while True: try: a,b,c,d,e,f=map(int,input().split()) y=(c*d-a*f)/(b*d-a*e) x=(e*c-b*f)/(a*e-b*d) if x==0: x=0 if y==0: y=0 print(f'{x:.3f} {y:.3f}') except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s643664918
p00004
Accepted
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))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s883770763
p00004
Accepted
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN 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 - c*d) / (a*e - b*d) if x == -0: x = int(x) if y == -0: y = int(y) X = Decimal(x).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP) Y = Decimal(y).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP) print(f'{X:.3f} {Y:.3f}') except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s611386787
p00004
Accepted
while True: try: a,b,c,d,e,f = map(int, input().split()) X = d/a y = (c*X-f)/(b*X-e) x = (c-b*y)/a print(f'{x:.3f} {y:.3f}') except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s283863171
p00004
Accepted
while True: try: a,b,c,d,e,f= map(int,input().split()) except EOFError: break x = (e*c-f*b)/(e*a-b*d) y = (d*c-f*a)/(d*b-a*e) if -0.0005 < x <= 0: x = 0.000 if -0.0005 < y <= 0: y = 0.000 print(f'{x:.3f}',f'{y:.3f}')
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s715414713
p00004
Accepted
while True: try: a,b,c,d,e,f = map(int,input().split()) x = (c * e - b * f) / (a * e - b * d) y = (c * d - a * f) / (b * d - a * e) if x == 0: x = 0 if y == 0: y = 0 print(f"{x:.3f} {y:.3f}") except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s138141594
p00004
Accepted
# coding: utf-8 # Your code here! def ren(a,b,c,d,e,f): x=(c*e-f*b)/(a*e-b*d) y=(c*d-f*a)/(b*d-e*a) print(f'{x+0:.3f} {y+0:.3f}') while True: try: a,b,c,d,e,f=map(int,input().split()) except EOFError: break ren(a,b,c,d,e,f)
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s717047307
p00004
Accepted
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN 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 - c*d) / (a*e - b*d) if x==-0: x=int(x) if int(y)==-0: y=int(y) X = Decimal(x).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP) Y = Decimal(y).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP) print(f'{X:.3f} {Y:.3f}') except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s473317775
p00004
Accepted
while True: try: a, b, c, d, e, f = map(int,input().split()) x = (b*f - e*c) / (b*d - a*e) y = (a*f - c*d) / (a*e - b*d) if x == -0.000: x = 0 print('{:.3f}'.format(x), '{:.3f}'.format(y)) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s984646495
p00004
Accepted
from decimal import Decimal,ROUND_HALF_UP,ROUND_HALF_EVEN while True: try: a,b,c,d,e,f=map(int,input().split()) x=(c*e-b*f)/(a*e-b*d) y=(a*f-c*d)/(a*e-b*d) if x==-0: x=int(x) if y==-0: y=int(y) X=Decimal(x).quantize(Decimal('0.001'),rounding=ROUND_HALF_UP) Y=Decimal(y).quantize(Decimal('0.001'),rounding=ROUND_HALF_UP) print(f'{X:3f}',f'{Y:3f}') except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s814827334
p00004
Accepted
while 1: try: a,b,c,d,e,f=map(int,input().split()) x=(c*d-a*f)/(b*d-a*e) print("{:.3f} {:.3f}".format((c-b*x)/a,x)) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s549773518
p00004
Accepted
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN 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 - c*d) / (a*e - b*d) if x==-0: x=int(x) if y==-0: y=int(y) X = Decimal(x).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP) Y = Decimal(y).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP) print(f'{X:.3f} {Y:.3f}') except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s945759227
p00004
Accepted
while True: try: a,b,c,d,e,f = (float(x) for x in input().split()) x = (c * e - b * f) / (a * e - b * d) y = (c * d - a * f) / (b * d - a * e) except: break x = round(x, 3) y = round(y, 3) if x == -0.000: x = 0.000 elif y == -0.000: y = 0.000 print("{0:.3f} {1:.3f}" . format(x, y))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s914485036
p00004
Accepted
#0004 while True: try: a,b,c,d,e,f = map(float,input().split()) y = (a*f-d*c)/(a*e-b*d) x = (f*b-e*c)/(b*d-a*e) if x == -0.0: x = 0.000 elif y == -0.0: y = 0.000 print(format(x, '.3f'),format(y, '.3f')) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s928462591
p00004
Accepted
# coding: utf-8 # 83 while True: try: a,b,c,d,e,f = map(float,input().split()) X = (f*b-e*c)/(b*d-e*a) Y = (a*f-d*c)/(a*e-b*d) if X==-0.0: X=0.0 elif Y==-0.0: Y=0.0 print(f"{X:.3f} {Y:.3f}") except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s414970991
p00004
Accepted
#83 連立方程式 while True: try: a, b, c, d, e, f = map(float,input().split()) except: break x = (e*c - b*f) / (a*e - b*d) y = (c*d - a*f) / (b*d - a*e) if x == -0.0 : x = 0.0 if y == -0.0 : y == 0.0 print(f'{x:.3f}', f'{y:.3f}')
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s219225327
p00004
Accepted
while True: try: a,b,c,d,e,f = map(int,input().split()) y = (c*d-f*a)/(b*d-e*a) x = (c-(b*y))/a print('{:.3f} {:.3f}'.format(x,y)) except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s070321105
p00004
Accepted
while 1: #ax+by=c #dx+ey=f try: a,b,c,d,e,f=map(float,input().split()) det=a*e-d*b x=(e*c-b*f)/det y=(-d*c+a*f)/det if abs(x) < 0.0001: x = 0.0 if abs(y) < 0.0001: y = 0.0 print(format(x,'.3f'),format(y,'.3f')) except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s656063466
p00004
Accepted
# coding: utf-8 # Your code here! c = 0.0001 while True: try: a = list(map(int,input().split())) b1 = a[0]*a[4]-a[3]*a[1] b2 = a[2]*a[4]-a[5]*a[1] b3 = a[0]*a[5]-a[3]*a[2] print("{0:.3f} {1:.3f}" .format(b2/b1 + c, b3/b1 + c)) except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s054123254
p00004
Accepted
from decimal import * while True: try: a,b,c,d,e,f=map(float, input().split()) except: break m=(c*e-b*f) n=(a*e-b*d) if m == 0.0: x=0.0 else: x=m/n m=(c*d-a*f) n=(b*d-a*e) if m == 0.0: y=0.0 else: y=m/n print(Decimal(str(x)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP),Decimal(str(y)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s041029897
p00004
Accepted
try: while True: a,b,c,d,e,f = map(float,input().split()) if a - d == 0: y = (c - f) / (b - e) x = (c - b*y) / a else: A = a*d D = d*a B = b*d C = c*d E = e*a F = f*a if C < F : y = (C - F) / (B - E) x = (c - b*y) / a else: y = (F - C) / (E - B) x = (c - b*y) / a print(f'{round(x,3):.03f}',f'{round(y,3):.03f}') except EOFError: pass
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s948626097
p00004
Accepted
while 1: try: a,b,c,d,e,f=map(float,input().split()) y = (c*d-a*f)/(b*d-a*e) x = (c-b*y)/a print(f'{x:.3f} {y:.3f}') except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s722724143
p00004
Accepted
try: while True: a,b,c,d,e,f=map(float,input().split()) x=(c*e-f*b)/(a*e-d*b) y=(c*d-f*a)/(b*d-e*a) if x==0: x=0.000 print(f'{x:5.3f} {y:5.3f}') except EOFError: pass
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s990641348
p00004
Accepted
while True: try: a,b,c,d,e,f=map(int,input().split()) m=b*d-e*a x=-(c*e-f*b)/m y=(c*d-f*a)/m if x==0: x=abs(x) if y==0: y=abs(y) print("{:.3f} {:.3f}" .format(x,y)) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s965171721
p00004
Accepted
while True: try: a,b,c,d,e,f = map(int,input().split()) except: break A = a*e - b*d x = (e*c - b*f)/A y = (a*f - d*c)/A # 出力の体裁を整え、-0.00を0.00にするため+0する print("{:.3f} {:.3f}".format(x+0,y+0))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s472554432
p00004
Accepted
while True: try: a,b,c,d,e,f=map(int, input().split()) y=(a*f-d*c)/(a*e-d*b) x=(-b*y+c)/a print("{:.3f} {:.3f}".format(x,y)) except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s463917214
p00004
Accepted
while 1: try: a,b,c,d,e,f=map(int,input().split()) x=(c*d-a*f)/(b*d-a*e) print("{:.3f} {:.3f}".format((c-b*x)/a,x)) except:break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s794378652
p00004
Accepted
def ren(a,b,c,d,e,f): x = (c*e-f*b)/(a*e-b*d) y = (c*d-f*a)/(b*d-e*a) print(f'{x+0:.3f} {y+0:.3f}') while True: try: a,b,c,d,e,f=map(float,input().split()) except: break ren(a,b,c,d,e,f)
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s715601263
p00004
Accepted
while True : try : a, b, c, d, e, f = map(int, input().split()) except EOFError : break x = (e*c - b*f) / (a*e - b*d) y = (c*d - a*f) / (b*d - a*e) if x == -0.0 : x = 0.0 if y == -0.0 : y == 0.0 print(f'{x:.3f}', f'{y:.3f}')
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s605857663
p00004
Accepted
while True: try: a,b,c,d,e,f=map(int,input().split()) x=(c*e-b*f)/(a*e-b*d) y=(c-a*x)/b if x==-0: x=0 if y==-0: y=0 print(f'{x:.3f} {y:.3f}') except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s961518311
p00004
Accepted
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) if x==-0: x=0 if y==-0: x=0 print(f'{x:.3f} {y:.3f}') except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s982415922
p00004
Accepted
while True: try: a,b,c,d,e,f = [int(x) for x in input().split()] x = (c*e - b*f)/(a*e - b*d) y = (c*d - a*f)/(b*d - a*e) if(x == 0): x = 0 if(y == 0): y = 0 print("{0:.3f} {1:.3f}".format(x,y)) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s660774404
p00004
Accepted
while 1: try: a, b, c, d, e, f = map(float, input().split()) except: break x = (c*e - b*f) / (a*e - b*d) y = (c*d - a*f) / (b*d - a*e) if x == 0: x = 0 if y == 0: y = 0 print('{:.3f}'.format(x), '{:.3f}'.format(y))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s667769215
p00004
Accepted
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))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s960108068
p00004
Accepted
from decimal import Decimal, ROUND_HALF_UP while True: try: a, b, c, d, e, f = map(float, input().split()) x = (c * e - b * f) / (a * e - b * d) + 0.0 y = (c * d - a * f) / (b * d - a * e) + 0.0 print(Decimal(str(x)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP), Decimal(str(y)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP)) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s942530619
p00004
Accepted
try: while True: a,b,c,d,e,f=map(int, input().split()) y = (a*f - c*d) / (a*e - b*d) x = (c - b*y) / a print('{:.03f}'.format(x), '{:.03f}'.format(y)) except: pass
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s875181443
p00004
Accepted
while True: try: a, b, c, d, e, f = map(float, input().split()) except: break if b==0: x = c/a y = (f-d*x)/e elif e==0: x = f/d y = (c-a*x)/b else: x = (b*f-c*e)/(b*d-a*e) y = c/b - a*x/b if x==0: print(f'{abs(x):.3f} {y:.3f}') elif y==0: print(f'{x:.3f} {abs(y):.3f}') else: print(f'{x:.3f} {y:.3f}')
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s847456676
p00004
Accepted
while True: try: a,b,c,d,e,f=map(float,input().split()) y=(c*d-a*f)/(b*d-a*e) x=(c-b*y)/a print(f'{x:.3f} {y:.3f}') except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s263341446
p00004
Accepted
while True: try: a,b,c,d,e,f=map(float,input().split()) except: break x=(b*f-c*e)/(b*d-a*e) (c*d-a*f)/(b*d-a*e) y=(c-a*x)/b if x==-0: x=0 if y==-0: y=0 print("{:.3f} {:.3f}".format(x,y))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s914697039
p00004
Accepted
while True: try: a,b,c,d,e,f=map(int,input().split()) det=a*e-b*d x=(e*c-b*f) y=(a*f-d*c) if det<0: x=-x y=-y det=-det print("%.03f %.03f" %(x/det,y/det)) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s014514822
p00004
Accepted
# coding: utf-8 # Your code here! while True: try: a, b, c, d, e, f = map(float, input().split()) x = (c * e - b * f) / (a * e - b * d) y = (c - a * x) / b if x == 0: print('{:.3f}'.format(abs(x)), '{:.3f}'.format(y)) elif y == 0: print('{:.3f}'.format(x), '{:.3f}'.format(abs(y))) else: print('{:.3f}'.format(x), '{:.3f}'.format(y)) except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s092518010
p00004
Accepted
while True: try: lst = list(map(int, input().split())) a, b, c, d, e, f = lst[0], lst[1], lst[2], lst[3], lst[4], lst[5] x = (b*f - c*e)/(b*d - a*e) y = (c*d - a*f)/(b*d - a*e) print('{:.3f}'.format(x+0.0), end = " ") print('{:.3f}'.format(y+0.0)) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s170759734
p00004
Accepted
while True: try: a,b,c,d,e,f = map(int,input().split()) except: break y=(c*d-a*f)/(b*d-a*e) print("{0:.3f} {1:.3f}".format((c-b*y)/a,y))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s738391256
p00004
Accepted
listal=[] while True: try: listal.append(input()) except: break for i in listal: j=list(map(int,i.split())) y=(j[3]*j[2]-j[0]*j[5])/(j[1]*j[3]-j[0]*j[4]) x=(j[2]-j[1]*y)/j[0] print('{:.3f}'.format(x),'{:.3f}'.format(y))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s862801633
p00004
Accepted
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))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s298536321
p00004
Accepted
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) if x == -0 : x = 0 if y == -0 : y = 0 print(f"{x:.3f} {y:.3f}") except : break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s891771307
p00004
Accepted
for i in range(1,100000000): try: a,b,c,d,e,f=map(int,input().split()) y=(a*f-d*c)/(e*a-b*d) x=(c-b*y)/a print(f'{x:.3f} {y:.3f}') except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s262002732
p00004
Accepted
for line in open(0).readlines(): a, b, c, d, e, f = map(int, line.split()) det = a*e - b*d x = (e*c - b*f) y = (a*f - d*c) if det < 0: x = -x; y = -y; det = -det print("%.03f %.03f" % (x/det, y/det))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s114716347
p00004
Accepted
import sys for line in sys.stdin.readlines(): a, b, c, d, e, f = map(float, line.split()) x = (c * e - b * f)/(a * e - b * d) y = (c * d - a * f)/(b * d - a * e) if ((c * e - b * f == 0) | (a * e - b * d == 0)): x = 0 if ((c * d - a * f == 0) | (b * d - a * e == 0)): y = 0 print('{:.3f}'.format(x), '{:.3f}'.format(y))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s507257531
p00004
Accepted
while 1: try: s=list(map(float,input().split())) up=s[4]/s[1] a=s[0]*up b=s[1]*up c=s[2]*up d=s[3] e=s[4] f=s[5] ad=a-d cf=c-f x=round(cf/ad,3) if x==-0.000: x=0.00 y=round((s[2] - s[0]*x)/s[1],3) if y==-0.000: y=0.000 print('{:.3f}'.format(x),'{:.3f}'.format(y)) except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s389640393
p00004
Accepted
while True: try: a,b,c,d,e,f = (float(x) for x in input().split()) x = (c * e - b * f) / (a * e - b * d) y = (c * d - a * f) / (b * d - a * e) if x == 0: x = 0 if y == 0: y = 0 print(format(x, ".3f"), format(y, ".3f")) except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s329197508
p00004
Accepted
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN while True: try: z = list(map(int,input().split())) except: break a = z[:3] b = z[3:] c = a[:] d = b[:] s = [a[0],b[0]] a = list(map(lambda x:x*s[1],a)) b = list(map(lambda x:x*s[0],b)) y = (b[2]-a[2])/(b[1]-a[1]) try: x = (c[2]-c[1]*y)/c[0] except: x = (d[2]-d[1]*y)/d[0] print(Decimal(str(x)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP),Decimal(str(y)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s863891241
p00004
Accepted
import sys lines = sys.stdin.readlines() for line in lines: s = str(line) a,b,c,d,e,f = map(int, s.rstrip('\n').split()) x = (e*c - b*f) / (a*e - b*d) if e*c - b*f == 0: x = 0 x = round(x, 3) y = (a*f - c*d) / (a*e - b*d) if a*f - c*d == 0: y = 0 y = round(y, 3) print(f'{x:.3f} {y:.3f}')
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s551564218
p00004
Accepted
import sys, math array = [] for line in sys.stdin: array.append(map(int, line.split(' '))) for a, b, c, d, e, f in array: determinant = a * e - b * d if determinant == 0: print('NO ANSWER') x = (c * e - b * f) / determinant y = (a * f - c * d) / determinant x = math.floor(x * 1000) / 1000 y = math.floor(y * 1000) / 1000 print('{0:.3f} {1:.3f}'.format(x, y))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s544080671
p00004
Accepted
while True: try: a,b,c,d,e,f=map(int,input().split()) x=(c*d-a*f)/(b*d-a*e) print("{:.3f} {:.3f}".format((c-b*x)/a,x)) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s346954932
p00004
Accepted
import sys;print("\n".join(["{:.3f}".format(int((e*c-b*f)/(a*e-b*d)*1000)/1000) + " " + "{:.3f}".format(int((-d*c+a*f)/(a*e-b*d)*1000)/1000) for x in sys.stdin for a, b, c, d, e, f in [[int(y) for y in x.split()]] ]))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s976167940
p00004
Accepted
k=[] try: while True: k.append(list(map(int,input().split()))) except EOFError: pass for a,b,c,d,e,f in k: if f*b-c*e==0: x=0 else: x=(f*b-c*e)/(b*d-a*e) if f*a-c*d==0: y=0 else: y=(f*a-c*d)/(a*e-b*d) print("%.3f %.3f" % (x,y))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s421577194
p00004
Accepted
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(1.0*t), x))) return '\n'.join(r) print(main())
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s348601055
p00004
Accepted
import sys for line in sys.stdin: 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("%.3lf %.3lf" %(x,y))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s561015510
p00004
Accepted
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"%(x,y)) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s021685069
p00004
Accepted
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))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s586066269
p00004
Accepted
# AOJ 0004 Simultaneous Equation # Python3 2018.6.9 bal4u 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
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s529185779
p00004
Accepted
try: while(True): a, b, c, d, e, f = map(int, input().split()) A = [[e/(a*e-b*d), (-1)*b/(a*e-b*d)],[(-1)*d/(a*e-b*d), a/(a*e-b*d)]] Y = [c, f] X = [(A[0][0]*Y[0] + A[0][1]*Y[1]), (A[1][0]*Y[0] + A[1][1]*Y[1])] for i in range(2): print('{:.3f}'.format(X[i]), end="") if i == 1: print("") else: print(" ", end="") except: pass
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s868055721
p00004
Accepted
import sys for line in sys.stdin: a, b, c, d, e, f = [float(x) for x in line.split()] x = (f * b - e * c) / (d * b - a * e) y = (c - a * x) / b if abs(x) < 0.00001: x = 0.000 if abs(y) < 0.00001: y = 0.000 print("%.3f %.3f" % (x, y) )
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s039828008
p00004
Accepted
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
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s095252935
p00004
Accepted
while True: try: a,b,c,d,e,f=map(int,input().split()) except: break ba=(a*e)-(d*b) x1=(c*e)-(f*b) y1=(a*f)-(d*c) x=round(x1/ba,4) if x==0: x=0.000 y=round(y1/ba,4) if y==0: y=0.000 print("{:.3f}".format(x),"{:.3f}".format(y))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s428079921
p00004
Accepted
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
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s573240619
p00004
Accepted
#!/usr/bin/env python3 import sys EPS = 1e-10 for line in sys.stdin: a, b, c, d, e, f = map(float, line.split()) x = (e * c - b * f) / (a * e - b * d) y = (a * f - c * d) / (a * e - b * d) print('{:.3f} {:.3f}'.format(x + EPS, y + EPS))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s516855918
p00004
Accepted
while True: try: a,b,c,d,e,f=map(float,input().split()) if (a*e-b*d)!=0: x=(c*e-f*b)/(a*e-b*d) if b!=0: y=(c-a*x)/b elif e!=0: y=(f-d*x)/e elif (b*d-e*a)!=0: y=(c*d-f*a)/(b*d-e*a) if a!=0: x=(c-b*y)/a elif d!=0: x=(f-e*y)/d if x==-0: x=x+0.0 if y==-0: y=y+0.0 print(f"{x:.3f}",f"{y:.3f}") except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s297165423
p00004
Accepted
import sys for line in sys.stdin.readlines(): a, b, c, d, e, f = [float(x) for x in line.split()] if a!=0 and d!=0: a, b, c = [x/a for x in [a, b, c]] d, e, f = [x/d for x in [d, e, f]] y = (c-f) / (b-e) x = c - b * y else: a, b, c = [x/b for x in [a, b, c]] d, e, f = [x/e for x in [d, e, f]] x = (c-f) / (a-d) y = c - a * x print(f'{x:.3f} {y:.3f}')
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s983058324
p00004
Accepted
while True: try: a,b,c,d,e,f = [int(x) for x in input().split()] x = (c*e - b*f)/(a*e - b*d) y = (c*d - a*f)/(b*d - a*e) if(x == 0): x = 0 if(y == 0): y = 0 print("{0:.3f} {1:.3f}".format(x,y)) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s755438420
p00004
Accepted
while True: try: a, b, c, d, e, f = map(float, input().split()) x = (e * c - f * b) / (e * a - d * b) + 0 y = (d * c - f * a) / (d * b - e * a) + 0 print('{0:.3f} {1:.3f}'.format(x, y)) except EOFError: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s800034088
p00004
Accepted
# coding: utf-8 import sys for line in sys.stdin: 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("%.3lf %.3lf" % (x, y))
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>
s553352882
p00004
Accepted
while True: try: a,b,c,d,e,f=list(map(float,input().split())) x=float((b*f-c*e)/(b*d-a*e)) y=float((c*d-a*f)/(b*d-a*e)) if x==-0.000: x=0.000 if y==-0.000: y=0.000 print("{0:.3f} {1:.3f}".format(x,y)) except: break
1 2 3 4 5 6 2 -1 -2 -1 -1 -5
-1.000 2.000 1.000 4.000
<H1>Simultaneous Equation</H1> <p> Write a program which solve a simultaneous equation:<br> <br> <var> ax + by = c</var><br> <var> dx + ey = f</var><br> <br> The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 &le; <var>a, b, c, d, e, f</var> &le; 1,000). You can suppose that given equation has a unique solution. </p> <H2>Input</H2> <p> The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF. </p> <H2>Output</H2> <p> For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <H2>Sample Input 1</H2> <pre> 1 2 3 4 5 6 2 -1 -2 -1 -1 -5 </pre> <H2>Output for the Sample Input 1</H2> <pre> -1.000 2.000 1.000 4.000 </pre> <H2>Sample Input 2</H2> <pre> 2 -1 -3 1 -1 -3 2 -1 -3 -9 9 27 </pre> <H2>Output for the Sample Input 2</H2> <pre> 0.000 3.000 0.000 3.000 </pre>