submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s287913691
p00004
Wrong Answer
# -*- coding:utf-8 -*- if __name__ == '__main__': while True: try: a, b, c, d, e, f = [float(num) for num in raw_input().split()] x = ((e*c)-(b*f))/((e*a)-(b*d)) y = ((d*c)-(a*f))/((d*b)-(a*e)) except: break print '%0.3f' % x print '%0.3f' % 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>
s087116161
p00004
Wrong Answer
# -*- coding:utf-8 -*- if __name__ == '__main__': while True: try: a, b, c, d, e, f = [float(num) for num in raw_input().split()] x = ((e*c)-(b*f))/((e*a)-(b*d)) y = ((d*c)-(a*f))/((d*b)-(a*e)) except: break print '%0.3f %0.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>
s615182121
p00004
Wrong Answer
import sys def gcd(a, b): return gcd(b, a % b) if a % b else b def lcm(a, b): return a * b / gcd(a, b) for line in sys.stdin: data = map(int, line.split()) a, b, c, d, e, f = data if a == 0: y = c * 1.0 / b x = (f - e * y) * 1.0 / d print "%.3f %.3f" % (round(x, 4), round(y, 4)) continue if b == 0: y = c * 1.0 / a x = (f - e * y) * 1.0 / d print "%.3f %.3f" % (round(x, 4), round(y, 4)) continue if d == 0: x = f * 1.0 / e y = (c - b * x) * 1.0 / a print "%.3f %.3f" % (round(x, 4), round(y, 4)) continue if e == 0: x = f * 1.0 / d y = (c - b * x) * 1.0 / a print "%.3f %.3f" % (round(x, 4), round(y, 4)) continue ix = lcm(a, d) / a jx = lcm(a, d) / d iy = lcm(b, e) / b jy = lcm(b, e) / e x = (c*1.0*iy - f*jy) / (a*iy - d*jy) y = (c*1.0*ix - f*jx) / (b*ix - e*jx) print "%.3f %.3f" % (round(x, 4), round(y, 4))
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>
s098004261
p00004
Wrong Answer
while True: try: (a,b,c,d,e,f) = map(int, 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>
s544728932
p00004
Wrong Answer
while True: try: (a,b,c,d,e,f) = map(int, raw_input().split()) y = (a * f - c * d) / (-b * d + e * a) x = (c - b * y) / a print '{0:.3f} {1:.3f}'.format(round(x,3), round(y,3)) 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>
s089967908
p00004
Wrong Answer
import sys for line in sys.stdin: a, b, c, d, e, f = map(int, line.rstrip('\n').split(' ')) x = str(int((d*c - b*f) * 1000 / (a*d - b*c))) y = str(int((a*f - c*c) * 1000 / (a*d - b*c))) print '%s.%s %s.%s' % (x[:-3], x[-3:], y[:-3], y[-3:])
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>
s773594889
p00004
Wrong Answer
import sys for line in sys.stdin: a, b, c, d, e, f = map(int, line.rstrip('\n').split(' ')) x = str(int((e*c - b*f) * 1000 / (a*e - b*d))) y = str(int((a*f - d*c) * 1000 / (a*e - b*d))) print '%s.%s %s.%s' % (x[:-3], x[-3:], y[:-3], y[-3:])
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>
s915674249
p00004
Wrong Answer
try: while 1: a, b, c, d, e, f = map(int,input().split()) x = (c/b-f/e) / (a/b-d/e) y = (c/a-f/d) / (b/a-e/d) print("{:+.3f} {:+.3f}".format(x,y)) 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>
s800506730
p00004
Wrong Answer
try: while 1: a, b, c, d, e, f = map(int,input().split()) x = (c/b-f/e) / (a/b-d/e) y = (c/a-f/d) / (b/a-e/d) print("{:.3f} {:.3f}".format(x,y)) 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>
s588366716
p00004
Wrong Answer
try: while 1: a, b, c, d, e, f = map(int,input().split()) x = (c/b-f/e) / (a/b-d/e) y = (c/a-f/d) / (b/a-e/d) if x == 0: x = 0 if y == 0: y = 0 print("{:.3f} {:.3f}".format(x,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>
s580876749
p00004
Wrong Answer
try: while 1: a, b, c, d, e, f = map(float,raw_input().split()) x = (c/b-f/e) / (a/b-d/e) y = (c/a-f/d) / (b/a-e/d) if x == 0: x = 0 if y == 0: y = 0 print("{:.3f} {:.3f}".format(x,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>
s763592994
p00004
Wrong Answer
while 1: try: a, b, c, d, e, f = map(float,raw_input().split()) x = (c/b-f/e) / (a/b-d/e) x = x if x else 0 y = (c/a-f/d) / (b/a-e/d) y = y if y else 0 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>
s667970926
p00004
Wrong Answer
#!/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 "%f %f" % (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>
s404655834
p00004
Wrong Answer
a, b, c, d, e, f = map(int, raw_input().split()) det = a*e-b*d x, y = float(e*c+(-b)*f)/det, float((-d)*c+a*f)/det print '%.3f %.3f' % (x, y)
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>
s601461352
p00004
Wrong Answer
data = raw_input().split('\n') for d in data: a, b, c, d, e, f = map(int, d.split()) det = a*e-b*d x, y = float(e*c+(-b)*f)/det, float((-d)*c+a*f)/det print '%.3f %.3f' % (x, y)
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>
s605678623
p00004
Wrong Answer
data = raw_input().split('\n') print data for d in data: a, b, c, d, e, f = map(int, d.split()) det = a*e-b*d x, y = float(e*c+(-b)*f)/det, float((-d)*c+a*f)/det print '%.3f %.3f' % (x, y)
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>
s107173983
p00004
Wrong Answer
data = raw_input() while data: try: a, b, c, d, e, f = map(int, data.split()) det = a*e-b*d x, y = float(e*c+(-b)*f)/det, float((-d)*c+a*f)/det print '%.3f %.3f' % (x, y) data = raw_input() 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>
s618832561
p00004
Wrong Answer
while True: try: a, b, c, d, e, f = map(int, raw_input().split()) det = a*e-b*d x, y = float(e*c+(-b)*f)/det, float((-d)*c+a*f)/det print '%.3f %.3f' % (x, y) 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>
s153487488
p00004
Wrong Answer
while True: try: a, b, c, d, e, f = map(int, raw_input().split()) det = float(a*e-b*d) x, y = (e*c+(-b)*f)/det, ((-d)*c+a*f)/det 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>
s113400701
p00004
Wrong Answer
import sys for s in sys.stdin: a,b,c,d,e,f=map(int,s.split()) y=(a*f-c*d)/(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>
s776062683
p00004
Wrong Answer
a, b, c, d, e, f = map(float, raw_input().split()) x = (c * e - b * f) / (a * e - d * b) y = (c * d - f * a) / (b * d - e * a) print ("{0:.4f} {1:.4f}".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>
s225513128
p00004
Wrong Answer
a, b, c, d, e, f = map(float, raw_input().split()) x = (c * e - b * f) / (a * e - d * b) y = (c * d - f * a) / (b * d - e * a) print ("{:.4f} {:.4f}".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>
s341867025
p00004
Wrong Answer
a, b, c, d, e, f = map(float, raw_input().split()) x = (c * e - b * f) / (a * e - d * b) y = (c * d - f * a) / (b * d - e * a) print ("{0:.3f} {1:.3f}".format(x + 0, y + 0))
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>
s321244007
p00004
Wrong Answer
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 print(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>
s312282891
p00004
Wrong Answer
# -*- coding: utf-8 -*- import sys 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) 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>
s126519759
p00004
Wrong Answer
# -*- coding: utf-8 -*- import sys 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) print "%.3f %.3f" % (round(x, 3), round(y, 3))
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>
s287993760
p00004
Wrong Answer
# -*- coding: utf-8 -*- import sys 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) print "%.3f %.3f\n" % (round(x, 3), round(y, 3))
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>
s696722492
p00004
Wrong Answer
# -*- 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" % (round(x, 3), round(y, 3))) 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>
s887842288
p00004
Wrong Answer
# -*- 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 = (c-a*x)/b outList.append("%.3f %.3f" % (round(x, 3), round(y, 3))) 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>
s891214473
p00004
Wrong Answer
# -*- 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, y)) 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>
s220099795
p00004
Wrong Answer
while True: try: a, b, c, d, e, f = map(int, raw_input().split()) x = float(b*c - e*f)/(a*e - b*d) y = float(c*d - a*f)/(b*d - a*e) print 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>
s748567404
p00004
Wrong Answer
while True: try: a, b, c, d, e, f = map(int, raw_input().split()) x = float(c*e - b*f)/(a*e - b*d) y = float(c*d - a*f)/(b*d - a*e) print 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>
s169519285
p00004
Wrong Answer
while True: try: a, b, c, d, e, f = map(int, raw_input().split()) x = float(c*e - b*f)/(a*e - b*d) y = float(c*d - a*f)/(b*d - a*e) print ("%f %f" %(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>
s597034438
p00004
Wrong Answer
while True: try: a, b, c, d, e, f = map(int, raw_input().split()) x = float(c*e - b*f)/(a*e - b*d) y = float(c*d - a*f)/(b*d - a*e) print ("%f %f" % (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>
s772596188
p00004
Wrong Answer
while True: try: a, b, c, d, e, f = map(int, raw_input().split()) x = float(c*e - b*f)/(a*e - b*d) y = float(c*d - a*f)/(b*d - a*e) print ("%f %f" % (round(x,-3), round(y),-3)) except: break
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>
s782249504
p00004
Wrong Answer
while True: try: a, b, c, d, e, f = map(int, raw_input().split()) x = float(c*e - b*f)/(a*e - b*d) y = float(c*d - a*f)/(b*d - a*e) print ("%f %f" % (round(x,-3), round(y,-3))) except: break
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>
s477991355
p00004
Wrong Answer
while True: try: a, b, c, d, e, f = map(int, raw_input().split()) x = float(c*e - b*f)/(a*e - b*d) y = float(c*d - a*f)/(b*d - a*e) print ("%.3f %.3f" % (round(x,-3), round(y,-3))) 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>
s629630228
p00004
Wrong Answer
while True: try: a, b, c, d, e, f = map(int, raw_input().split()) x = float(c*e - b*f)/(a*e - b*d) y = float(c*d - a*f)/(b*d - a*e) print ("%.3f %.3f" % (round(x,-4), round(y,-4))) 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>
s243606076
p00004
Wrong Answer
while True: try: a, b, c, d, e, f = map(int, raw_input().split()) x = float(c*e - b*f)/(a*e - b*d) y = float(c*d - a*f)/(b*d - a*e) print ("%.3f %.3f" % (round(x,4), round(y,4))) 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>
s441438913
p00004
Wrong Answer
while True: try: a, b, c, d, e, f = map(int, raw_input().split()) x = float(c*e - b*f)/(a*e - b*d) y = float(c*d - a*f)/(b*d - a*e) print ("%.3f %.3f" % (round(x,3), round(y,3))) 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>
s217688248
p00004
Wrong Answer
while True: try: a, b, c, d, e, f = map(int, raw_input().split()) x = float(c*e - b*f)/(a*e - b*d) y = float(c*d - a*f)/(b*d - a*e) x = round(1000*x)/1000 y = round(1000*y)/1000 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>
s108884189
p00004
Wrong Answer
while True: try: a, b, c, d, e, f = map(floar, raw_input().split()) x = (c*e - b*f)/(a*e - b*d) y = (c*d - a*f)/(b*d - a*e) x = round(1000*x)/1000 y = round(1000*y)/1000 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>
s632249896
p00004
Wrong Answer
while True: try: a, b, c, d, e, f = map(float, raw_input().split()) x = (c*e - b*f)/(a*e - b*d) y = (c*d - a*f)/(b*d - a*e) x = round(1000*x)/1000 y = round(1000*y)/1000 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>
s869578796
p00004
Wrong Answer
while True: try: a, b, c, d, e, f = map(float, raw_input().split()) x = (c*e - b*f)/(a*e - b*d) y = (c*d - a*f)/(b*d - a*e) x = round(10000*x)/10000 y = round(10000*y)/10000 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>
s072993075
p00004
Wrong Answer
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) x=(b*c-e*f)*1.0/(a*e-b*d) 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>
s682266650
p00004
Wrong Answer
while 1: try: a, b, c, d, e, f = map(int, raw_input().split()) g = b / e x = (c - g * f) / (float(a) - g) y = (c - a * x) / float(b) print str(x) + " " + str(y) + "\n" 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>
s622765167
p00004
Wrong Answer
while 1: try: a, b, c, d, e, f = map(int, raw_input().split()) g = float(b) / float(e) x = (c - g * f) / (a - g) y = (c - a * x) / b print str(x) + " " + str(y) + "\n" 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>
s536095072
p00004
Wrong Answer
while 1: try: a, b, c, d, e, f = map(float, raw_input().split()) x = (c * e - b * f) / (a * e - b * d) y = (f * a - c * d) / (a * e - d * b) print str(x) + " " + str(y) + "\n" 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>
s958691168
p00004
Wrong Answer
while 1: try: a, b, c, d, e, f = map(float, raw_input().split()) x = ( (c * e - b * f) * 1000 / (a * e - b * d) ) / 1000 y = ( (f * a - c * d) * 1000 / (a * e - d * b) ) / 1000 print str(x) + " " + str(y) + "\n" 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>
s255292721
p00004
Wrong Answer
while 1: try: a, b, c, d, e, f = map(float, raw_input().split()) x = ( (c * e - b * f) * 1000 / (a * e - b * d) ) / 1000 y = ( (f * a - c * d) * 1000 / (a * e - d * b) ) / 1000 print str('%3f' % x) + " " + str('%3f' % y) + "\n" 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>
s593070563
p00004
Wrong Answer
while 1: try: a, b, c, d, e, f = map(float, raw_input().split()) x = ( (c * e - b * f) * 1000 / (a * e - b * d) ) / 1000 y = ( (f * a - c * d) * 1000 / (a * e - d * b) ) / 1000 print str('%.3f' % x) + " " + str('%.3f' % y) + "\n" 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>
s854905846
p00004
Wrong Answer
while 1: try: a, b, c, d, e, f = map(float, raw_input().split()) x = (c * e - b * f) / (a * e - b * d) y = (f * a - c * d) / (a * e - d * b) print str('%.3f' % x) + " " + str('%.3f' % y) + "\n" except: break
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>
s271343706
p00004
Wrong Answer
while 1: try: a, b, c, d, e, f = map(float, raw_input().split()) x = ((c * e - b * f) * 1000 / (a * e - b * d)) / 1000 y = ((f * a - c * d) * 1000 / (a * e - d * b)) / 1000 print str('%.3f' % x) + " " + str('%.3f' % y) + "\n" 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>
s167505616
p00004
Wrong Answer
while 1: try: a, b, c, d, e, f = map(float, raw_input().split()) x = (((c * e - b * f) * 1000) / (a * e - b * d)) / 1000 y = (((f * a - c * d) * 1000) / (a * e - d * b)) / 1000 print str('%.3f' % x) + " " + str('%.3f' % y) + "\n" 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>
s024997272
p00004
Wrong Answer
while 1: try: a, b, c, d, e, f = map(float, raw_input().split()) x = (c * e - b * f) / (a * e - b * d) y = (f * a - c * d) / (a * e - d * b) print str('%.3f' % x) + " " + str('%.3f' % y) + "\n" except: break
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>
s281198030
p00004
Wrong Answer
while 1: try: a, b, c, d, e, f = map(float, raw_input().split()) x = (c * e - b * f) / (a * e - b * d) y = (f * a - c * d) / (a * e - d * b) print str(round(('%.3f' % x), 3)) + " " + str(round(('%.3f' % y), 3)) + "\n" 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>
s389733857
p00004
Wrong Answer
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(round(('%.3f' % x), 3)) + " " + str(round(('%.3f' % y), 3)) + "\n" 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>
s602294984
p00004
Wrong Answer
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 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>
s017094247
p00004
Wrong Answer
try: while True: a, b, c, d, e, f = map(int, raw_input().split()) x = (c * e - b * f) / (a * e - b * d) y = (f * a - c * d) / (a * e - d * b) print round(x, 3), round(y, 3) 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>
s089435159
p00004
Wrong Answer
try: while True: a, b, c, d, e, f = map(int, raw_input().split()) x = (c * e - b * f) / (a * e - b * d) y = (f * a - c * d) / (a * e - d * b) print "{:.3f} {:.3f}".format(round(x, 3), round(y, 3)) 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>
s544622015
p00004
Wrong Answer
a,b,c,d,e,f = map(int,raw_input().split()) x = float(b*f - c*e) / (b*d - a*e) y = float(c*d - a*f) / (b*d - a*e) print "%0.3f %0.3f" % (round(x,3),round(y,3))
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>
s093336878
p00004
Wrong Answer
while 1: try: a,b,c,d,e,f = map(float,raw_input().split()) x = (b*f - c*e) / (b*d - a*e) y = (c*d - a*f) / (b*d - a*e) print "%.3f %.3f" % (round(x,3),round(y,3)) 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>
s294796004
p00004
Wrong Answer
while 1: try: a,b,c,d,e,f = map(float,raw_input().split()) x = (b*f - c*e) / (b*d - a*e) y = (c*d - a*f) / (b*d - a*e) print "%.3f %.3f" % (round(x,4),round(y,4)) 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>
s685299395
p00004
Wrong Answer
def zero3(n): ret = str(n) while len(ret) < 3: ret = "0" + ret return ret def to_str(n): a = int(n*0.001) b = n % 1000 return str(a) + "." + zero3(b) while 2>1: try: a,b,c,d,e,f = map(int, raw_input().split(" ")) x=int(1000*(c*e-b*f)/(e*a-b*d) + 0.5) y=int(1000*(c*d-a*f)/(b*d-e*a) + 0.5) print " ".join(map(to_str,[x,y])) 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>
s018415806
p00004
Wrong Answer
import math def zero3(n): ret = str(n) while len(ret) < 3: ret = "0" + ret return ret def to_str(n): a = int(n*0.001) b = n % 1000 return str(a) + "." + zero3(b) while 2>1: try: a,b,c,d,e,f = map(int, raw_input().split(" ")) x=int(math.floor(1000*(c*e-b*f)/(e*a-b*d) + 0.5)) y=int(math.floor(1000*(c*d-a*f)/(b*d-e*a) + 0.5)) print " ".join(map(to_str,[x,y])) 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>
s364072822
p00004
Wrong Answer
while 2>1: try: a,b,c,d,e,f = map(int, 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,y) 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>
s980214594
p00004
Wrong Answer
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,y) 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>
s952627053
p00004
Wrong Answer
a,b,c,d,e,f = map(int,raw_input().split()) x = float(c * e - b * f)/(a * e - b * d) y = float(c * d - a * f)/(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>
s078937985
p00004
Wrong Answer
a,b,c,d,e,f = map(float,raw_input().split()) x = ((c * e) - (b * f))/((a * e) - (b * d)) y = ((c * d) - (a * f))/((b * d) - (a * e)) print "%0.3f %0.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>
s624879973
p00004
Wrong Answer
while True: try: a,b,c,d,e,f = map(float,raw_input().split()) x = (e*c-b*f) / (e*a-b*d) y = (c*d-a*f) / (b*d-e*a) print '%.3f %.3f' % (x,y) except EOFError: break
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>
s409812619
p00004
Wrong Answer
while True: try: line = input() except: break a,b,c,d,e,f = map(int, line.strip().split()) z = a * e - b * d x = (c * e - b * f) / z y = (a * f - c * d) / z print('{:.3f} {:.3f}'.format(x, y))
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>
s140258112
p00004
Time Limit Exceeded
import sys while (True): L = map(float, sys.stdin.readline().split()) if L: (a, b, c, d, e, f) = L x = (e * c - b * f) / (a * e - b * d) y = (a * f - d * c) / (a * e - b * d) print x, y
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>
s046145577
p00004
Time Limit Exceeded
import sys import time def anscheck(x,y,d,e,f): # print "%.3f %.3f %.3f %.3f %.3f"%(x,y,d,e,f) if d*x+e*y == f: # print "correct!" print "%.3f %.3f"%(x,y) return True else: # print "different" return False for line in sys.stdin: a,b,c,d,e,f = map(float,line.split()) i=1 while True: if (a*i-c) % b ==0: x=i if a*i-c>0: y= -((a*i-c)/b) elif a*i-c<0: y= (a*i-c)/b else: pass if anscheck(x,y,d,e,f): break # if b*i-c % a == 0: # x=i # if b*i>c: # y= -(b*i-c)/a # elif b*i<c: # y= (b*i-c)/a # else: # pass # anscheck(x,y,d,e,f) if (a*(-i)-c) % b ==0: x=-i if a*(-i)-c>0: y= (a*(-i)-c)/b elif a*(-i)-c<0: y= -((a*(-i)-c)/b) else: pass if anscheck(x,y,d,e,f): break # if b*(-i)-c % a ==0: # x=-i # if b*(-i)>c: # y= -(b*(-i)-c)/a # elif b*(-i)<c: # y= (b*(-i)-c)/a # else: # pass # anscheck(x,y,d,e,f) i+=1.0
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>
s447913133
p00004
Time Limit Exceeded
import sys import time def anscheck(x,y,d,e,f): # print "%.3f %.3f %.3f %.3f %.3f"%(x,y,d,e,f) if d*x+e*y == f: # print "correct!" print "%.3f %.3f"%(x,y) return True else: # print "different" return False for line in sys.stdin: a,b,c,d,e,f = map(float,line.split()) i=1 while True: if (a*i-c) % b ==0: x=i if a*i-c>0: if b>0: y= -((a*i-c)/b) else: y= (a*i-c)/b elif a*i-c<0: if b>0: y= -((a*i-c)/b) else: y= (a*i-c)/b else: pass if anscheck(x,y,d,e,f): break # if b*i-c % a == 0: # x=i # if b*i>c: # y= -(b*i-c)/a # elif b*i<c: # y= (b*i-c)/a # else: # pass # anscheck(x,y,d,e,f) if (a*(-i)-c) % b ==0: x=-i if a*(-i)-c>0: if b>0: y= -((a*(-i)-c)/b) else: y= (a*(-i)-c)/b elif a*(-i)-c<0: if b>0: y= -((a*(-i)-c)/b) else: y= (a*(-i)-c)/b else: pass if anscheck(x,y,d,e,f): break # if b*(-i)-c % a ==0: # x=-i # if b*(-i)>c: # y= -(b*(-i)-c)/a # elif b*(-i)<c: # y= (b*(-i)-c)/a # else: # pass # anscheck(x,y,d,e,f) i+=1.0
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>
s063490257
p00004
Time Limit Exceeded
import sys import time def anscheck(x,y,d,e,f): # print "%.3f %.3f %.3f %.3f %.3f"%(x,y,d,e,f) # time.sleep(1) if d*x+e*y == f: # print "correct!" print "%.3f %.3f"%(x,y) return True else: # print "different" return False for line in sys.stdin: a,b,c,d,e,f = map(float,line.split()) i=0 while True: if (a*i-c) % b ==0: x=i if a*i-c>0: y= -((a*i-c)/b) elif a*i-c<0: y= (a*i-c)/b else: y=0 if anscheck(x,y,d,e,f): break # if b*i-c % a == 0: # x=i # if b*i>c: # y= -(b*i-c)/a # elif b*i<c: # y= (b*i-c)/a # else: # pass # anscheck(x,y,d,e,f) if (a*(-i)-c) % b ==0: x=-i if a*(-i)-c > 0: y= (a*(-i)-c)/b elif a*(-i)-c<0: y= -((a*(-i)-c)/b) else: y=0 if anscheck(x,y,d,e,f): break # if b*(-i)-c % a ==0: # x=-i # if b*(-i)>c: # y= -(b*(-i)-c)/a # elif b*(-i)<c: # y= (b*(-i)-c)/a # else: # pass # anscheck(x,y,d,e,f) i+=1.0
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>
s053972370
p00004
Time Limit Exceeded
import sys import time def anscheck(x,y,d,e,f): # print "%.3f %.3f %.3f %.3f %.3f"%(x,y,d,e,f) # time.sleep(1) if d*x+e*y == f: # print "correct!" print "%.3f %.3f"%(x,y) return True else: # print "different" return False for line in sys.stdin: a,b,c,d,e,f = map(float,line.split()) i=0 while True: tmp = c-a*i if tmp % b ==0: x=i y=tmp/b if anscheck(x,y,d,e,f): break tmp = c-a*(-i) if tmp % b ==0: x=-i y=tmp/b if anscheck(x,y,d,e,f): break i+=1.0
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>
s702991252
p00004
Time Limit Exceeded
import itertools import operator dataset = [] while True: try: dataset.append(input()) except EOFError: break for item in dataset: a, b, c, d, e, f = [int(i) for i in item.split()] for i in range(-1000, 1001): for j in range(-1000, 1001): if a * i + b * j == c and d * i + e * j == f: print("{:.3f} {:.3f}".format(i, j))
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>
s251396755
p00004
Time Limit Exceeded
z = [] while True: try: a, b, c, d, e, f = map(float, raw_input().split()) x = (c * e - b * f) / (a * e - d * b) y = (c * d - f * a) / (b * d - e * a) z.append([x, y]) except: print(z)
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>
s131967940
p00004
Accepted
while True: try: a,b,c,d,e,f=map(int,input().split()) print("{0:.3f} {1:.3f}".format((c*e-b*f)/(a*e-b*d)+1e-10,(a*f-c*d)/(a*e-b*d)+1e-10)) except:break
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>
s965021203
p00004
Accepted
while True: try: a, b, c, d, e, f = map(float, raw_input().split()) except: break y = (c*d-a*f)/(b*d-a*e) x=(c - b*y) / a print "%.3f %.3f" % (x, y)
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>
s349184928
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>
s687894772
p00004
Accepted
while True: try: (a,b,c,d,e,f) = map(int,input().split()) except: break g = (a * e) - (b * d) ans1= "{0:.3f}".format((( e * c) + ( -b * f)) / g + 0) ans2= "{0:.3f}".format(((-d * c) + ( a * f)) / g + 0) print (ans1,ans2)
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>
s367512495
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>
s147254113
p00004
Accepted
def equation(a,b,c,d,e,f,x): buff = a*e-b*d buff_a = a a = e/buff b = -b/buff d = -d/buff e = buff_a/buff x.append((a*c)+(b*f)) x.append((d*c)+(e*f)) count = 0 a = [] b = [] c = [] d = [] e = [] f = [] while True: try: buff = input().split() a.append(float(buff[0])) b.append(float(buff[1])) c.append(float(buff[2])) d.append(float(buff[3])) e.append(float(buff[4])) f.append(float(buff[5])) count += 1 except: break for i in range(count): ans = [] equation(a[i],b[i],c[i],d[i],e[i],f[i],ans) print('{:.3f}'.format(ans[0]),'{:.3f}'.format(ans[1]))
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>
s476597336
p00004
Accepted
while True: try: a,b,c,d,e,f=[int(i) for i in input().split()] x=(c*e-f*b)/(a*e-b*d) y=(a*f-d*c)/(a*e-b*d) if abs(x)<1e-4: x=0.0 if abs(y)<1e-4: y=0.0 print("{:.3f} {:.3f}".format(x,y)) except: break
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>
s550836910
p00004
Accepted
#det = ae - bd #x = (ce - bf) / det #y = (af - cd) / det #-0.000 対策 EPS = 1e-4 while True: try: a, b, c, d, e, f = map(float, input().split()) det = a*e - b*d x = (c*e - b*f) / det + EPS y = (a*f - c*d) / det + EPS print('{0:.3f} {1:.3f}'.format(x, y)) except EOFError: break
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>
s436803611
p00004
Accepted
while True: try: a, b, c, d, e, f = map(float, input().split()) except EOFError: break det = a * e - b * d if det != 0: x = (1 / det) * (e * c - b * f) y = (1 / det) * (a * f - c * d) if x >= 0: xx = (int)(x * 1000) if xx % 10 <= 4: ansx = (xx - xx%10) / 1000 else: ansx = (xx + (10 - xx%10)) / 1000 else: xx = (int)(x * -1000) if xx % 10 <= 4: ansx = (xx - xx%10) / -1000 else: ansx = (xx + (10 - xx%10)) / -1000 if y >= 0: yy = (int)(y * 1000) if yy % 10 <= 4: ansy = (yy - yy%10) / 1000 else: ansy = (yy + (10 - yy%10)) / 1000 else: yy = (int)(y * -1000) if yy % 10 <= 4: ansy = (yy - yy%10) / -1000 else: ansy = (yy + (10 - yy%10)) / -1000 print("{0:.3f} {1:.3f}".format(ansx, ansy))
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>
s362421982
p00004
Accepted
#! -*- coding: utf-8-unix -*- #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0004 import sys def main_(a,b,c,d,e,f): y = (a*f-d*c)/(a*e-d*b) x = (c - b * y) / a return (x, y) def main(lines): for line in lines: a,b,c,d,e,f = map(float, line.split(' ')) print '%.3f %.3f' % main_(a,b,c,d,e,f) return if __name__=='__main__': lines = [] for line in sys.stdin: lines.append(line.strip()) # print lines main(lines)
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>
s202208086
p00004
Accepted
while True: try: a, b, c, d, e, f = map(int, input().strip("\n").split(" ")) z = a * e - b * d if z == 0: break x = (c * e - b * f) y = (f * a - c * d) x /= z y /= z # zero toshite atsukau if -0.0004 < x < 0.0004: x = abs(x) if -0.0004 < y < 0.0004: y = abs(y) print("{0:.3f} {1:.3f}".format(x, y)) except EOFError: break # escape from while loop
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>
s742779761
p00004
Accepted
while True: try: [a, b, c, d, e, f] = map(float, raw_input().split()) i = d/a j = i * b - e k = i * c - f y = float(k/j) x = float((c - b * y)/a) print "%.3f %.3f" % (x, y) except (EOFError): break;
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>
s318865595
p00004
Accepted
while True: try: (a,b,c,d,e,f)=map(float,raw_input().split()) x=(f-c*e/b)/(d-a*e/b) y=(c-a*x)/b if abs(x)<1e-3: x=0 if abs(y)<1e-3: y=0 print "%.3f %.3f" % (x,y) except EOFError: break
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>
s372147686
p00004
Accepted
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys for s in sys.stdin: d = map( float, s.split() ) det = d[0]*d[4]-d[1]*d[3] x = ( d[4]*d[2]-d[1]*d[5] ) / det y = ( -d[3]*d[2]+d[0]*d[5] ) / det if x == 0: x = 0 if y == 0: y = 0 print "%.3f %.3f" % ( x, y )
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>
s756965233
p00004
Accepted
import math import itertools while 1: try: a, b, c, d, e, f = map(int, input().split()) print('{0:.3f} {1:.3f}'.format((e*c-b*f)/(a*e-b*d)+0, (-d*c+a*f)/(a*e-b*d)+0)) except: break
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>
s680381341
p00004
Accepted
while 1: try: a, b, c, d, e, f = map(int, input().split()) y = (-d*c+a*f)/(a*e-b*d) print('{:.3f} {:.3f}'.format((c-b*y)/a, y)) except EOFError: break
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>
s044361000
p00004
Accepted
while 1: try: i = raw_input() a, b, c, d, e, f = map(float, i.split()) y = ((c * d) - (a * f)) / ((b * d) - (a * e)) x = (c - (b * y)) / a print "%.3f %.3f" % (x, y) except: break
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>
s531225038
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}'.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>
s997343135
p00004
Accepted
import sys for line in sys.stdin.readlines(): a, b, c, d, e, f = map(float, line.strip().split()) y = ((c * d) - (a * f)) / ((b * d) - (a * e)) x = (c - (b * y)) / a print "{0:.3f}".format(x), print "{0:.3f}".format(y)
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>
s174482516
p00004
Accepted
# coding: utf8 import sys for line in sys.stdin: a, b, c, d, e, f = map(float, line.split()) if (c * e - b * f) == 0: x = 0.0 else: x = round((c*e-b*f)/(a*e-b*d), 3) if (c * d - a * f) == 0: y = 0.0 else: y = round((c*d-a*f)/(b*d-a*e), 3) print '%.3f %.3f' % (x, y)
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>
s007973450
p00004
Accepted
import sys for s in sys.stdin: a, b, c, d, e, f = map(float, s.split()) y = (a*f - d*c)/(a*e - d*b) x = (c - b*y)/a print '%.03f %.03f'%(x, y)
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>
s648289586
p00004
Accepted
import sys for line in sys.stdin: a, b, c, d, e, f = map(int, line.split()) y = (a * f - d * c) / (a * e - b * d) x = (c * e - b * f) / (a * e - b * d) if x == 0: x = abs(x) if y == 0: x = abs(y) print('{:.3f} {:.3f}'.format(x, y))
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>