s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1 value | original_language stringclasses 11 values | filename_ext stringclasses 1 value | status stringclasses 1 value | cpu_time int64 0 100 | memory stringlengths 4 6 | code_size int64 15 14.7k | code stringlengths 15 14.7k | problem_id stringlengths 6 6 | problem_description stringlengths 358 9.83k | input stringlengths 2 4.87k | output stringclasses 807 values | __index_level_0__ int64 1.1k 1.22M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s271766220 | p00004 | u572790226 | 1459855392 | Python | Python3 | py | Accepted | 20 | 7324 | 279 | import sys
lines = sys.stdin.readlines()
for line in lines:
a, b, c, d, e, f = map(float, line.split())
if a * e - b * d == 0:
break
x = (e * c + (-b) * f)/(a * e - b * d)
y = ((-d) * c + a * f)/(a * e - b * d)
print('{:.3f} {:.3f}'.format(x+0, y+0)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,302 |
s800962440 | p00004 | u454259029 | 1460825929 | Python | Python3 | py | Accepted | 30 | 7320 | 268 | while(True):
try:
a,b,c,d,e,f=map(float,input().split(" "))
z=a*e-b*d
if(z!=0):
x=(c*e-b*f)/z
y=(a*f-c*d)/z
print("{:.3f} {:.3f}".format(x+0,y+0))
except:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,303 |
s791046181 | p00004 | u894114233 | 1461760806 | Python | Python | py | Accepted | 10 | 6236 | 176 | while 1:
try:
a,b,c,d,e,f=map(float,raw_input().split())
y=(c*d-f*a)/(b*d-e*a)
x=(c-b*y)/a
print "%.3f %.3f"%(x,y)
except:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,304 |
s969931884 | p00004 | u412890344 | 1463448778 | Python | Python3 | py | Accepted | 30 | 7720 | 876 | def get_input():
while True:
try:
yield "".join(input())
except EOFError:
break
if __name__ == "__main__":
array = list(get_input())
for i in range(len(array)):
temp_a,temp_b,temp_c,temp_d,temp_e,temp_f = array[i].split()
a,b,c,d,e,f = int(temp_a),int(temp_b),int(temp_c),int(temp_d),int(temp_e),int(temp_f)
if a!=0:
if e-b*d/a !=0:
y = (f-c*d/a)/(e-b*d/a)
x = (c - b*y)/a
else:
print("cannot solve equation")
else:
if b!=0:
y = c/b
if d!=0:
x = (f -e*y)/d
else:
print("cannot solve equation")
print("{:.3f} {:.3f}".format(x,y))
| p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,305 |
s850114292 | p00004 | u403901064 | 1464617372 | Python | Python3 | py | Accepted | 20 | 7432 | 500 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
while True:
try:
form = [float(x) for x in input().split(" ")]
except:
return
else:
if form[0] == 0:
y = form[2] / form[1]
x = (form[5] - y * form[4]) / form[3]
else:
b = form[1] / form[0]
c = form[2] / form[0]
e = form[4] - form[3] * b
f = form[5] - form[3] * c
y = f / e
x = (form[2] - y * form[1]) / form[0]
print("{:.3f} {:.3f}".format(x,y))
if __name__ == '__main__':
main() | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,306 |
s494389333 | p00004 | u957021485 | 1465561854 | Python | Python3 | py | Accepted | 20 | 7588 | 268 | import sys
dataset = sys.stdin.readlines()
for item in dataset:
a, b, c, d, e, f = list(map(int, item.split()))
y = (c * d - f * a)/(b * d - e * a)
x = (c * e - b * f) / (a * e - b * d)
if x == 0:
x = 0
print("{:.3f} {:.3f}".format(x, y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,307 |
s515510200 | p00004 | u203261375 | 1466234243 | Python | Python3 | py | Accepted | 20 | 7436 | 264 | import sys
for line in sys.stdin:
a,b,c,d,e,f = map(float, line.split())
x = round((c*e-b*f)/(a*e-b*d), 3)
y = round((a*f-c*d)/(a*e-b*d), 3)
if x == -0:
x = 0
if y == -0:
y = 0
print("{0:.3f}".format(x), "{0:.3f}".format(y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,308 |
s175658270 | p00004 | u617990214 | 1467124722 | Python | Python3 | py | Accepted | 30 | 7532 | 801 | #ax+by=c
#dx+ey=f
#
#->x=(ce-bf)/(ae-bd),y=(af-cd)/(ae-bd)
#
def maru(f):
if f>=0:
sgn="+"
else:
sgn="-"
f=abs(f)
#
f*=1000
f_int =f-f%1
f_float=f%1
#
if f_float>=0.5:
f_int+=1
else:
pass
#
f=int(f_int)
if f%1000==0:
s="000"
else:
s=f%1000
if sgn=="-":
p="-"+str(f//1000)+"."+str(s)
else:
p=str(f//1000)+"."+str(s)
return p
##########################################
#test_sisyagonyuu
#while True:
# k=float(input())
# print("k=",k)
# print("maru(k)=",maru(k))
##########################################
ans=[]
while True:
try:
a,b,c,d,e,f=list(map(float,input().split(" ")))
if c*e-b*f==0:
x=0
else:
x=(c*e-b*f)/(a*e-b*d)
if a*f-c*d==0:
y=0
else:
y=(a*f-c*d)/(a*e-b*d)
ans.append(maru(x)+" "+maru(y))
except:
break
for i in ans:
print(i) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,309 |
s269195163 | p00004 | u811773570 | 1467192807 | Python | Python3 | py | Accepted | 40 | 7524 | 302 | while True:
try:
a, b, c, d, e, f = map(int, input(). split())
D = (a * e) - (b * d)
x = (e * c) - (b * f)
y = (a * f) - (d * c)
x /= D
y /= D
if x / D == 0:
x = 0
if y / D == 0:
y = 0
print("%.3f %.3f" % (round(x, 3), round(y, 3)))
except:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,310 |
s989697263 | p00004 | u146816547 | 1468971102 | Python | Python | py | Accepted | 0 | 6336 | 257 | while True:
try:
a, b, c, d, e, f = map(float, raw_input().split())
x = (e*c-b*f) / (e*a-b*d)
y = (c*d-a*f) / (b*d-e*a)
if x == -0.0:
x = 0
if y == -0.0:
y = 0
print '%.3f %.3f' % (x,y)
except EOFError:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,311 |
s518989551 | p00004 | u896025703 | 1469451176 | Python | Python3 | py | Accepted | 20 | 7360 | 198 | while True:
try:
a, b, c, d, e, f = map(float, input().split())
x = (c*e - b*f) / (a*e - b*d)
y = (c*d - a*f) / (b*d - a*e)
print("{:.3f} {:.3f}".format(x+0, y+0))
except EOFError:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,312 |
s286233683 | p00004 | u626838615 | 1469790239 | Python | Python3 | py | Accepted | 20 | 7444 | 448 | while True:
try:
a, b, c, d, e, f = [float(x) for x in input().split()]
except:
exit()
m = [[a,b,c],[d,e,f]]
row = len(m)
col = len(m[0])
for k in range(row):
for j in range(k+1,col):
m[k][j] /=m[k][k]
for i in range(row):
if(i != k):
for j in range(k+1,col):
m[i][j] -= m[i][k] * m[k][j]
print ("%.3f %.3f" % (m[0][2],m[1][2])) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,313 |
s070745859 | p00004 | u582608581 | 1470283048 | Python | Python3 | py | Accepted | 30 | 7544 | 397 | def Cramer(coef):
deno = coef[0]*coef[4] - coef[1]*coef[3]
return [(coef[2]*coef[4] - coef[1]*coef[5]) / deno, (coef[0]*coef[5] - coef[2]*coef[3]) / deno]
while True:
try:
coeflist = [float(item) for item in input().split()]
ans1, ans2 = Cramer(coeflist)
if abs(ans1) < 1e-4:
ans1 = 0.0
if abs(ans2) < 1e-4:
ans2 = 0.0
print('%.3f %.3f' %(ans1, ans2))
except EOFError:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,314 |
s575043553 | p00004 | u358919705 | 1471814005 | Python | Python3 | py | Accepted | 20 | 7344 | 267 | while True:
try:
a, b, c, d, e, f = map(float, input().split())
x = round((c * e - b * f) / (a * e - b * d), 3)
y = round((a * f - c * d) / (a * e - b * d), 3)
print('{0:.3f} {1:.3f}'.format(x + 0, y + 0))
except:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,315 |
s172466479 | p00004 | u589886885 | 1471935190 | Python | Python3 | py | Accepted | 20 | 7540 | 202 | import sys
for i in sys.stdin.readlines():
a, b, c, d, e, f = [int(x) for x in i.split()]
y = (c * d - a * f) / (b * d - a * e)
x = (c - b * y) / a
print('{0:.3f} {1:.3f}'.format(x, y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,316 |
s489603143 | p00004 | u058433718 | 1473870891 | Python | Python3 | py | Accepted | 20 | 7440 | 517 | # ????????£???????¨????????§£???????????°??????
# ax + by = c
# dx + ey = f
import sys
def inverse(a, b, d, e):
deta = a * e - b * d
return (deta, e, -b, -d, a)
while True:
data = sys.stdin.readline()
if data is None or data.strip() == '':
break
data = data.strip().split(' ')
a, b, c, d, e, f = [float(i) for i in data]
inv = inverse(a, b, d, e)
x = (inv[1] * c + inv[2] * f) / inv[0] + 0
y = (inv[3] * c + inv[4] * f) / inv[0] + 0
print('%.3f %.3f' % (x, y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,317 |
s569065520 | p00004 | u505912349 | 1475844938 | Python | Python3 | py | Accepted | 20 | 7424 | 344 | import sys
for line in sys.stdin:
array = [float(x) for x in line.split()]
ar1 = array[0:3]
ar2 = array[3:]
i = ar1[0]
ar1 = [x*ar2[0] for x in ar1]
ar2 = [x*i for x in ar2]
y = (ar1[2] - ar2[2])/(ar1[1]-ar2[1])
ar1 = array[0:3]
x = (ar1[2]-ar1[1]*y)/ar1[0]
print('%.3f %.3f' % (round(x,3), round(y,3))) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,318 |
s039554816 | p00004 | u813534019 | 1477069062 | Python | Python | py | Accepted | 10 | 6252 | 130 | import sys
for l in sys.stdin:
a,b,c,d,e,f=map(float,l.split())
x=a*e-b*d
print"%0.3f %0.3f"%(c*e/x-b*f/x,a*f/x-c*d/x) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,319 |
s772521001 | p00004 | u766597310 | 1477669580 | Python | Python | py | Accepted | 0 | 6260 | 476 | from sys import stdin
def deal(x):
if abs(x) < 1e-6: return 0
else: return x
def solve(a, b, c, d, e, f):
x = 0
y = 0
if b == 0:
x = c / a
y = (f - d * x) / e
else:
x = (b * f - e * c) / (b * d - e * a)
y = (c - a * x) / b
p = [deal(x), deal(y)]
return p
for s in stdin:
s = s[:-1]
s = map(float, s.split())
p = solve(s[0], s[1], s[2], s[3], s[4], s[5])
print ("%.3f "%p[0] + "%.3f"%p[1]) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,320 |
s381587227 | p00004 | u659302741 | 1477677167 | Python | Python3 | py | Accepted | 30 | 7588 | 264 | import sys
for line in sys.stdin:
a, b, e, c, d, f = map(int, line.split())
det = a * d - b * c
a11 = d / det
a12 = - b / det
a21 = - c / det
a22 = a / det
print("%.3f %.3f" % (round(a11 * e + a12 * f, 3), round(a21 * e + a22 * f, 3))) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,321 |
s788726767 | p00004 | u500396695 | 1477872715 | Python | Python3 | py | Accepted | 30 | 7404 | 240 | import sys
L = sys.stdin.readlines()
for line in L:
A = line.split()
a, b, c, d, e, f = [float(A[i]) for i in range(6)]
x = (b * f - c * e) / (b * d - a * e)
y = (c * d - a * f) / (b * d - a * e)
print("{:.3f} {:.3f}".format(x+0, y+0)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,322 |
s309992650 | p00004 | u166871988 | 1477924848 | Python | Python3 | py | Accepted | 20 | 7448 | 488 | while True:
try:raw=[float(i) for i in input().split(" ")]
except:break
a=raw[:3]
b=raw[3:]
yx=[]
ed={0:1,1:0}
for e in range(2):
ab=[i*b[e] for i in a]
ba=[i*a[e] for i in b]
yx.append((ab[2]-ba[2])/(ab[ed[e]]-ba[ed[e]]))
sisya=[i*10000-int(i*1000)*10 for i in yx]
kekka=[True if i>4 else False for i in sisya]
x="{0:.3f}".format(yx[1]+int(kekka[1])/1000)
y="{0:.3f}".format(yx[0]+int(kekka[0])/1000)
print(x+" "+y) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,323 |
s875792016 | p00004 | u149199817 | 1477972966 | Python | Python3 | py | Accepted | 20 | 7540 | 832 | # -*- coding: utf-8 -*-
import sys
def solve_sim_equ(a, b, c, d, e, f):
'''
This function solves following equation.
ax + by = c
dx + ey = f
'''
if a==0 and d==0:
if b==0 and e==0:
return 0., 0.
if b != 0:
return 0., c/b+0.
else:
return 0., f/e+0.
elif b==0 and e==0:
if a != 0:
return 0., d/a+0.
else:
return 0., a/d+0.
if b == 0:
a, d = d, a
b, e = e, b
c, f = f, c
g = e / b
x = (g*c - f) / (g*a - d)
y = (c - a*x) / b
return x+0., y+0.
def main():
for line in sys.stdin:
a,b,c,d,e,f = map(float, line.split())
x, y = solve_sim_equ(a, b, c, d, e, f)
print('{0:.3f} {1:.3f}'.format(x,y))
if __name__ == '__main__':
main() | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,324 |
s710722062 | p00004 | u175111751 | 1478536683 | Python | Python3 | py | Accepted | 30 | 7660 | 234 | while True:
try:
a, b, c, d, e, f = map(int, input().split())
except EOFError:
break
else:
y = (f - c * d / a) / (e - b * d / a)
x = c/a - b*y/a
print('{0:.3f} {1:.3f}'.format(x, y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,325 |
s203300205 | p00004 | u660912567 | 1478709868 | Python | Python3 | py | Accepted | 20 | 7676 | 169 | import sys
for line in sys.stdin:
a,b,c,d,e,f = list(map(int, line.split()))
y = (f-(d*c)/a)/((a*e-d*b)/a)
x = (c-b*y)/a
print('%03.3f' % x,'%03.3f' % y) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,326 |
s390502795 | p00004 | u922871577 | 1479278839 | Python | Python | py | Accepted | 10 | 6372 | 236 | import sys
for line in sys.stdin:
a, b, c, d, e, f = map(float, line.split())
b /= a
c /= a
a = 1.0
e -= b*d
f -= c*d
d = 0
f /= e
e = 1.0
c -= b*f
print '%.3f %.3f'%(round(c, 3), round(f, 3)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,327 |
s381993382 | p00004 | u919202930 | 1479288124 | Python | Python3 | py | Accepted | 20 | 7416 | 328 | # input
inputs = []
while True:
try:
inputs.append(list(map(float,input().split())))
except EOFError:
break
# calculation
for i in inputs:
x=(i[2]*i[4]-i[1]*i[5])/(i[0]*i[4]-i[1]*i[3])
y=(i[0]*i[5]-i[2]*i[3])/(i[0]*i[4]-i[1]*i[3])
if x == -0.000:x=0
if y == -0.000:y=0
print("{0:.3f} {1:.3f}".format(x,y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,328 |
s222718102 | p00004 | u779577827 | 1479472768 | Python | Python3 | py | Accepted | 20 | 7572 | 265 | import sys
[[print("{0:.3f} {1:.3f}".format(round((t[2] - t[1] * (t[0] * t[5] - t[2] * t[3]) / (t[0] * t[4] - t[1] * t[3])) / t[0], 3), round((t[0] * t[5] - t[2] * t[3]) / (t[0] * t[4] - t[1] * t[3]), 3))) for t in [[int(y) for y in x.split()]]] for x in sys.stdin] | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,329 |
s043100980 | p00004 | u542645301 | 1479478620 | Python | Python3 | py | Accepted | 50 | 7356 | 254 | import sys
[print("{0:.3f} {1:.3f}".format((k[2] - k[1] * ((k[0] * k[5] - k[2] * k[3]) / (k[0] * k[4] - k[1] * k[3]))) / k[0], ((k[0] * k[5] - k[2] * k[3]) / (k[0] * k[4] - k[1] * k[3])))) for i in sys.stdin for k in [[int(float(j)) for j in i.split()]]] | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,330 |
s204887286 | p00004 | u546285759 | 1480327553 | Python | Python3 | py | Accepted | 30 | 7568 | 250 | while True:
try:
a, b, c, d, e, f = map(int, input().split())
tb, tc = d*b, d*c
te, tf = a*e, a*f
y = (tc-tf)/(tb-te)
x = (c-(y*b))/a
print("{0:.3f} {1:.3f}".format(x, y))
except:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,331 |
s209663174 | p00004 | u086566114 | 1480570476 | Python | Python | py | Accepted | 10 | 6260 | 446 | import sys
for line in sys.stdin:
[a, b, c, d, e, f] = [float(x) for x in line.split()]
determinant = a * e - d * b
x = e * c - b * f
y = -d * c + a * f
x /= determinant
y /= determinant
if "%.3f" % (x) == "-0.000":
result_x = "0.000"
else:
result_x = "%.3f" % (x)
if "%.3f" % (y) == "-0.000":
result_y = "0.000"
else:
result_y = "%.3f" % (y)
print result_x, result_y | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,332 |
s733436784 | p00004 | u123687446 | 1480652061 | Python | Python3 | py | Accepted | 20 | 7344 | 195 | while True:
try:
a,b,c,d,e,f = list(map(float, input().split()))
except EOFError:
break
print("{0:.3f} {1:.3f}".format((c*e-b*f)/(a*e-b*d)+0., (a*f-c*d)/(a*e-b*d)+0.)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,333 |
s863522721 | p00004 | u301729341 | 1480989889 | Python | Python3 | py | Accepted | 20 | 7672 | 384 | while True:
try:
a,b,c,d,e,f = map(int,input().split())
x = (c*e - f*b)/(a*e - b*d)
y = (c*d - f*a)/(b*d - e*a)
x = round(x,3)
y = round(y,3)
if x == -0.0:
x = 0.0
if y == -0.0:
y = 0.0
print("{0:.3f}".format(x),end = ' ')
print("{0:.3f}".format(y))
except EOFError:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,334 |
s683585649 | p00004 | u811733736 | 1481120283 | Python | Python3 | py | Accepted | 30 | 7780 | 528 | import sys
from math import fabs
if __name__ == '__main__':
epsilon = 1e-9
# ??????????????\?????¨???????????????
for line in sys.stdin:
a, b, e, c, d, f = [int(x) for x in line.strip().split(' ')]
x = 1/(a*d-b*c) * (d*e - b*f)
y = 1/(a*d-b*c) * (-c*e + a*f)
# ?¨????????????¨?????? -0.0 ???????????´???????????¶?????? 0.0 ?????????
if fabs(x) < epsilon:
x = 0.0
if fabs(y) < epsilon:
y = 0.0
print('{0:.3f} {1:.3f}'.format(x, y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,335 |
s769135077 | p00004 | u266872031 | 1481303329 | Python | Python | py | Accepted | 10 | 6272 | 286 | while(1):
try:
[a,b,c,d,e,f]=map(int,raw_input().split())
det=a*e-d*b
x,y=(e*c-b*f)/float(det) ,(-d*c+a*f)/float(det)
xs,ys='%.3f'%x,'%.3f'%y
xs,ys=['0.000' if t=='-0.000' else t for t in [xs,ys]]
print xs,ys
except:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,336 |
s445538864 | p00004 | u661290476 | 1483002058 | Python | Python3 | py | Accepted | 30 | 7428 | 199 | while True:
try:
a,b,c,d,e,f=[float(i) for i in input().split()]
except:
break
x=(c*e-b*f)/(a*e-b*d)
y=(c*d-a*f)/(b*d-a*e)
print("{0:.3f} {1:.3f}".format(x+0,y+0)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,337 |
s147738582 | p00004 | u711765449 | 1483539850 | Python | Python3 | py | Accepted | 30 | 7532 | 520 | # -*- coding:utf-8 -*-
import sys
def solve_eq(a,b,c,d,e,f):
x = ((e*c)-(b*f))/((a*e)-(b*d))
y = ((a*f)-(c*d))/((a*e)-(b*d))
if x == -0:
x = 0
if y == -0:
y = 0
sol = [x,y]
return sol
array = []
for i in sys.stdin:
array.append(i)
a = [0]*6
for i in range(len(array)):
x = array[i].split()
for i in range(len(x)):
a[i] = float(x[i])
ans = solve_eq(a[0],a[1],a[2],a[3],a[4],a[5])
print("{0:0.3f}".format(ans[0]), "{0:0.3f}".format(ans[1])) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,338 |
s204842146 | p00004 | u078042885 | 1483857016 | Python | Python3 | py | Accepted | 20 | 7536 | 160 | while 1:
try:
a,b,c,d,e,f=map(int,input().split())
x=(c*d-a*f)/(b*d-a*e)
print("{:.3f} {:.3f}".format((c-b*x)/a,x))
except:break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,339 |
s714721028 | p00004 | u078042885 | 1485156998 | Python | Python3 | py | Accepted | 30 | 7656 | 133 | while 1:
try:a,b,c,d,e,f=map(int,input().split())
except:break
x=(c*d-a*f)/(b*d-a*e)
print("%.3f %.3f"%((c-b*x)/a,x)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,340 |
s651615219 | p00004 | u811841526 | 1485607846 | Python | Python3 | py | Accepted | 20 | 7568 | 221 | while True:
try:
a,b,c,d,e,f = map(int, input().split())
except EOFError:
break
x = c/a - (b/a) * (a*f-c*d) / (a*e-b*d)
y = (f*a - c*d) / (e*a - b*d)
print('{:.3f} {:.3f}'.format(x, y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,341 |
s484144638 | p00004 | u252414452 | 1485784969 | Python | Python | py | Accepted | 10 | 6320 | 350 | import sys
def to_f(e):
return float(e)
while True:
line = sys.stdin.readline()
if not line: break
a,b,c,d,e,f = map(to_f, line.rstrip().split(" "))
x = (c*e-b*f)/(a*e-d*b)
y = (c*d-a*f)/(b*d-a*e)
if x == 0:
x = 0
if y == 0:
y = 0
sys.stdout.write("{0:.3f}".format(x))
sys.stdout.write(" ")
print "{0:.3f}".format(y) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,342 |
s088274918 | p00004 | u519227872 | 1486468606 | Python | Python3 | py | Accepted | 20 | 7536 | 217 | from sys import stdin
for l in stdin:
a,b,c,d,e,f = map(int,l.split())
x = round((c*e-b*f)/(a*e-b*d),3) + 0.000
y = round((c*d-a*f)/(b*d-a*e),3) + 0.000
print("%s %s"%("{0:.3f}".format(x),"{0:.3f}".format(y))) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,343 |
s173094197 | p00004 | u766477342 | 1487077899 | Python | Python3 | py | Accepted | 20 | 7588 | 335 | def _round(x, d=0):
p = 10 ** d
return (x * p * 2 + 1) // 2 / p
try:
while 1:
a, b, c, d, e, f = list(map(int, input().split()))
s = (a * e - b * d)
x = e * c - b * f
y = -c * d + a * f
print("{:0.3f}".format(_round(x / s, 4)), "{:0.3f}".format(_round(y / s, 4)))
except:
pass | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,344 |
s858421495 | p00004 | u301461168 | 1487746115 | Python | Python3 | py | Accepted | 20 | 7440 | 423 | import sys
nums = []
for line in sys.stdin:
nums.append(line)
for i in range(len(nums)):
input_line = nums[i].split(" ")
a = float(input_line[0])
b = float(input_line[1])
c = float(input_line[2])
d = float(input_line[3])
e = float(input_line[4])
f = float(input_line[5])
x = (f * b - e * c)/(b * d - a * e)
y = (c - a * x)/b
print("{:.3f} {:.3f}".format(x+0,y+0))
| p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,345 |
s089794995 | p00004 | u831244171 | 1487841003 | Python | Python3 | py | Accepted | 30 | 7660 | 270 | import sys
dataset = sys.stdin.readlines()
for item in dataset:
a, b, c, d, e, f = list(map(int, item.split()))
y = (c * d - f * a)/(b * d - e * a)
x = (c * e - b * f) / (a * e - b * d)
if x == 0:
x = 0
print("{:.3f} {:.3f}".format(x, y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,346 |
s362715367 | p00004 | u630566146 | 1488472568 | Python | Python3 | py | Accepted | 30 | 7348 | 295 | while True:
try:
a, b, c, d, e, f = map(float, input().split())
x = (c*e - b*f)/(a*e - b*d)
y = (a*f - c*d)/(a*e - b*d)
if x == 0.0:
x = abs(x)
if y == 0.0:
y = abs(y)
print('%.3f %.3f' %(x,y))
except:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,347 |
s087804907 | p00004 | u630566146 | 1488472672 | Python | Python3 | py | Accepted | 30 | 7320 | 211 | while True:
try:
a, b, c, d, e, f = map(float, input().split())
x = (c*e - b*f)/(a*e - b*d)
y = (a*f - c*d)/(a*e - b*d)
print('%.3f %.3f' %(x+0,y+0))
except:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,348 |
s692186984 | p00004 | u901080241 | 1488949073 | Python | Python3 | py | Accepted | 20 | 7368 | 275 | import sys
for line in sys.stdin:
a = list(map(float, line.split()))
x = (a[4] * a[2] - a[1] * a[5]) / (a[0] * a[4] - a[1] * a[3]) + 0.0
y = (a[0] * a[5] - a[3] * a[2]) / (a[0] * a[4] - a[1] * a[3]) + 0.0
print("{:>.3f}".format(x) +" " + "{:>.3f}".format(y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,349 |
s661141732 | p00004 | u459418423 | 1488965664 | Python | Python3 | py | Accepted | 20 | 7592 | 383 | import sys
lines = sys.stdin.readlines()
for l in lines:
nums = list(map(int, l.split()))
A = [nums[0], nums[1], nums[3], nums[4]]
B = [nums[2], nums[5]]
detA = A[0]*A[3] - A[1]*A[2]
inA = [A[3], -A[1], -A[2], A[0]]
solutions = [n/detA+0.0 for n in [inA[0]*B[0] + inA[1]*B[1], inA[2]*B[0] + inA[3]*B[1]]]
print("%.3f %.3f" % (solutions[0], solutions[1])) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,350 |
s840535086 | p00004 | u810591206 | 1489035708 | Python | Python3 | py | Accepted | 30 | 7352 | 259 | import sys
lines = sys.stdin.readlines()
for line in lines:
a, b, c, d, e, f = map(float, line.split())
A = a * e - b * d
if A == 0:
break
x = (c * e - b * f) / A
y = (a * f - c * d) / A
print('{:.3f} {:.3f}'.format(x+0, y+0)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,351 |
s314640780 | p00004 | u421925564 | 1489126855 | Python | Python3 | py | Accepted | 20 | 7296 | 324 | #_*_ coding:utf-8 _*_
import sys
while True:
vals = sys.stdin.readline()
if(vals is None or vals.strip() == '' ):
break
a,b,c,d,e,f=list( map(float,vals.strip().split()))
temp = a * e - d * b
x = (c * e - b * f) / temp + 0.0
y = (c * d - a * f) / -temp + 0.0
print('%.3f %.3f' % (x,y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,352 |
s575632183 | p00004 | u421925564 | 1489126883 | Python | Python3 | py | Accepted | 30 | 7236 | 324 | #_*_ coding:utf-8 _*_
import sys
while True:
vals = sys.stdin.readline()
if(vals is None or vals.strip() == '' ):
break
a,b,c,d,e,f=list( map(float,vals.strip().split()))
temp = a * e - d * b
x = (c * e - b * f) / temp + 0.0
y = (c * d - a * f) / -temp + 0.0
print('%.3f %.3f' % (x,y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,353 |
s432731849 | p00004 | u318658123 | 1489405032 | Python | Python3 | py | Accepted | 20 | 7560 | 584 | #coding:utf-8
import sys
def calc(nums):
a = nums[0]
b = nums[1]
c = nums[2]
d = nums[3]
e = nums[4]
f = nums[5]
val = 1 / (a * e - b * d)
x = val * (e * c - b * f) + 0.
y = val * (- c * d + a * f) + 0.
return "%0.3f" % round(x, 3), "%0.3f" % round(y,3)
if __name__ == '__main__':
lines = []
for line in sys.stdin:
if line == "\n":
break
else :
lines.append(line)
for line in lines:
x,y = calc([ int(item) for item in line.split(" ")])
print(str(x) + " " + str(y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,354 |
s447981906 | p00004 | u921541953 | 1489925250 | Python | Python3 | py | Accepted | 20 | 7336 | 280 | import sys
lines = sys.stdin.readlines()
for line in lines:
a, b, c, d, e, f = map(float, line.split())
if a * e - b * d == 0:
break
x = (e * c + (-b) * f)/(a * e - b * d)
y = ((-d) * c + a * f)/(a * e - b * d)
print('{:.3f} {:.3f}'.format(x+0, y+0)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,355 |
s061342813 | p00004 | u072398496 | 1490147554 | Python | Python | py | Accepted | 10 | 6308 | 145 | import sys
eps=1e-9
for l in sys.stdin:
a,b,c,d,e,f=map(float,l.split())
x=(f-e*c/b)/(d-e*a/b)
y=(a*x-c)/b
print "%.3f %.3f" % (x+eps,-y+eps) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,356 |
s019470113 | p00004 | u036236649 | 1490595249 | Python | Python3 | py | Accepted | 30 | 7260 | 204 | import sys
for line in sys.stdin:
a, b, c, d, e, f = map(float, line.split())
print('{0:.3f} {1:.3f}'.format(
(e * c - f * b) / (e * a - d * b) + 0, (d * c - f * a) / (d * b - e * a) + 0)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,357 |
s654425324 | p00004 | u462831976 | 1490852858 | Python | Python3 | py | Accepted | 20 | 7316 | 281 | import sys
lines = sys.stdin.readlines()
for line in lines:
a, b, c, d, e, f = map(float, line.split())
if a * e - b * d == 0:
break
x = (e * c + (-b) * f)/(a * e - b * d)
y = ((-d) * c + a * f)/(a * e - b * d)
print('{:.3f} {:.3f}'.format(x+0, y+0)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,358 |
s617084464 | p00004 | u462831976 | 1490853021 | Python | Python3 | py | Accepted | 20 | 7668 | 319 | # -*- coding: utf-8 -*-
import sys
import os
for s in sys.stdin:
a, b, c, d, e, f = list(map(int, s.split()))
delta = a * e - b * d
if delta == 0:
break
else:
x = 1 / delta * (e * c - b * f)
y = 1 / delta * (-d * c + a * f)
print('{:.3f} {:.3f}'.format(x + 0, y + 0)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,359 |
s142183572 | p00004 | u371289566 | 1491221635 | Python | Python3 | py | Accepted | 30 | 7692 | 308 | def r(val):
v = val
m = 1
if val<0 : m=-1
val = int(abs(val)*1000+0.51)*m
return val/1000
def solve():
[a,b,c,d,e,f] = list(map(int,input().split()))
[x,y] = [e*c - b*f,a*f - c*d]
di = a*e-b*d
x /= di
y /= di
x = r(x)
y = r(y)
print("%.3f %.3f"%(x,y))
while True:
try: solve()
except: break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,360 |
s894596424 | p00004 | u518711553 | 1491487239 | Python | Python3 | py | Accepted | 30 | 7248 | 289 | import sys
def mul4(v1, v2, v3, v4):
return (v1 * v2) - (v3 * v4)
for i in sys.stdin:
a, b, e, c, d, f = tuple(map(float, i.split()))
det = mul4(a, d, c, b)
print("{:.3f} {:.3f}".format(
mul4(d, e, b, f) / det or 0.0,
-mul4(c, e, a, f) / det or 0.0)
) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,361 |
s073661660 | p00004 | u509278866 | 1491882858 | Python | Python3 | py | Accepted | 60 | 13380 | 2,617 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
class Matrix():
def __init__(self, A):
self.A = A
self.row = len(A)
self.col = len(A[0])
def __iter__(self):
return self.A.__iter__()
def __getitem__(self, i):
return self.A.__getitem__(i)
def __add__(self, B):
aa = self.A
bb = B.A
return Matrix([[aa[i][j] + bb[i][j] for j in range(self.col)] for i in range(self.row)])
def __sub__(self, B):
aa = self.A
bb = B.A
return Matrix([[aa[i][j] - bb[i][j] for j in range(self.col)] for i in range(self.row)])
def __mul__(self, B):
aa = self.A
bb = B.A
a = []
for i in range(self.row):
ai = aa[i]
r = []
for j in range(B.col):
r.append(sum([ai[k] * bb[k][j] for k in range(self.col)]))
a.append(r)
return Matrix(a)
def __truediv__(self, x):
pass
def lu(self):
size = self.row
T = copy.deepcopy(self.A)
L = [[0]*size for _ in range(size)]
U = [[0]*size for _ in range(size)]
for i in range(size):
for j in range(i,size):
L[j][i] = T[j][i]
for j in range(i,size):
U[i][j] = T[i][j] / T[i][i]
for j in range(i+1,size):
for k in range(i+1,size):
T[j][k] -= L[j][i] * U[i][k]
return Matrix(L),Matrix(U)
def __str__(self):
return self.A.__str__()
def solve_se(A, b):
n = A.row
L,U = A.lu()
y = []
for i in range(n):
t = b[i]
for k in range(i):
t -= L[i][k] * y[k]
y.append(t / L[i][i])
x = [0] * n
for i in range(n-1,-1,-1):
t = y[i]
for k in range(i+1,n):
t -= U[i][k] * x[k]
x[i] = t
return x
def main():
sa = [s for s in sys.stdin.read().split('\n') if s]
r = []
for s in sa:
a,b,c,d,e,f = [int(c) for c in s.split()]
A = Matrix([[a,b],[d,e]])
B = [c,f]
x = solve_se(A,B)
r.append(' '.join(map(lambda t: '{:01.3f}'.format(1.0*t), x)))
return '\n'.join(r)
print(main()) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,362 |
s402973924 | p00004 | u307520683 | 1491890722 | Python | Python | py | Accepted | 10 | 6244 | 318 | while True:
try:
a,b,c,d,e,f = map(float,raw_input().split())
x = ( e*c - b*f ) / ( e*a - b*d )
y = ( c*d - a*f ) / ( b*d - e*a )
if x == -0.000:
x = 0.000
if y == -0.000:
y = 0.000
print '%.3f %.3f' % (x,y)
except EOFError:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,363 |
s332593807 | p00004 | u868716420 | 1492288628 | Python | Python3 | py | Accepted | 20 | 7500 | 224 | while True :
try :
a, b, c, d, e, f = [int(_) for _ in input().split()]
y = (a * f - c * d) / (a * e - b * d)
x = (c - b * y) / a
print('{0:0.3f} {1:0.3f}'.format(x, y))
except : break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,364 |
s215232973 | p00004 | u000317780 | 1493740597 | Python | Python3 | py | Accepted | 20 | 7684 | 911 | # coding:utf-8
import sys
def determination(ls):
return ls[0][0]*ls[1][1]-ls[0][1]*ls[1][0]
def inversion(ls):
ret = []
tmp = [x for x in ls]
det = determination(tmp)
if det == 0:
return False
else:
tmp[0][0], tmp[1][1] = tmp[1][1], tmp[0][0]
tmp[0][1] = tmp[0][1]*(-1)
tmp[1][0] = tmp[1][0]*(-1)
for x in tmp:
ret.append(list(map(lambda x:x/det, x)))
return ret
def dot(a,b):
ret = []
for x in a:
ret.append(x[0]*b[0] + x[1]*b[1])
return ret
def simueq(a,b):
return dot(inversion(a), b)
def main():
for line in sys.stdin:
ls = list(map(int, line.split(' ')))
a = [[ls[0], ls[1]], [ls[3], ls[4]]]
b = [ls[2], ls[5]]
answer = simueq(a,b)
print('%.3f' % round(answer[0],3), '%.3f' % round(answer[1],3))
if __name__ == "__main__":
main() | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,365 |
s456477587 | p00004 | u362104929 | 1494585265 | Python | Python3 | py | Accepted | 30 | 7656 | 779 | def main():
def get_inputs():
li = []
try:
while True:
li.append(input())
except EOFError:
return li
def my_round(num, ndigits=3):
num = num * 10**ndigits
num = (num*2 + 1)//2
num = num / 10**ndigits
num = "{0:.3f}".format(num) ##
return num
li = get_inputs()
for str_num in li:
tmp = str_num.split(" ")
for i in range(len(tmp)):
tmp[i] = int(tmp[i])
a,b,c,d,e,f = tmp[0],tmp[1],tmp[2],tmp[3],tmp[4],tmp[5]
x = (c*e - b*f) / (a*e - b*d)
x = my_round(x)
y = (c*d - a*f) / (b*d - a*e)
y = my_round(y)
print("{} {}".format(x,y))
return None
if __name__ == '__main__':
main() | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,366 |
s777383332 | p00004 | u123596571 | 1494756329 | Python | Python3 | py | Accepted | 30 | 7296 | 195 | while True:
try:
a,b,c,d,e,f = map(float, input().split())
z = a*e - b*d
if z != 0:
y = (a*f - c*d) / z
x = (c*e - b*f) / z
print("{:.3f} {:.3f}".format(x+0,y+0))
except:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,367 |
s764575932 | p00004 | u717959831 | 1494897243 | Python | Python3 | py | Accepted | 30 | 7656 | 336 | import sys
lines = []
for line in sys.stdin:
num = line.split(" ")
a, b, e, c, d, f = int(num[0]), int(num[1]), int(num[2]), int(num[3]), int(num[4]), int(num[5])
x = (e*d-b*f)/(a*d-b*c)
y = (a*f-e*c)/(a*d-b*c)
if x == -0.0:
x = 0.0
if y == -0.0:
y = 0.0
print("{0:.3f} {1:.3f}".format(x,y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,368 |
s745576227 | p00004 | u905313459 | 1496059213 | Python | Python3 | py | Accepted | 30 | 7748 | 416 | import fileinput
if __name__ == "__main__":
for line in fileinput.input():
v = [int(i) for i in line.split(" ")]
x = (v[2] * v[4] - v[1] * v[5]) / (v[0] * v[4] - v[1] * v[3])
y = (v[2] * v[3] - v[0] * v[5]) / (v[1] * v[3] - v[0] * v[4])
if -0.0005 < x <= 0:
x = 0.000
if -0.0005 < y <= 0:
y = 0.000
print(format(x, ".3f"), format(y, ".3f")) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,369 |
s214562607 | p00004 | u922489088 | 1496236995 | Python | Python3 | py | Accepted | 20 | 7576 | 196 | import sys
for line in sys.stdin:
a,b,c,d,e,f = map(int,line.strip().split(' '))
x = (c*e - b*f) / (a*e - b*d)
y = (c*d - a*f) / (b*d - a*e)
print("{:.3f} {:.3f}".format(x+0, y+0)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,370 |
s570452714 | p00004 | u440180827 | 1496828051 | Python | Python3 | py | Accepted | 20 | 7352 | 253 | import sys
for line in sys.stdin:
a, b, c, d, e, f = map(float, line.split())
x = (c*e - b*f) / (a*e - b*d)
y = (a*f - c*d) / (a*e - b*d)
if x == -0.0:
x = 0
if y == -0.0:
y = 0
print('{:.3f} {:.3f}'.format(x, y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,371 |
s945259554 | p00004 | u440180827 | 1496828201 | Python | Python3 | py | Accepted | 20 | 7532 | 251 | import sys
for line in sys.stdin:
a, b, c, d, e, f = map(int, line.split())
x = (c*e - b*f) / (a*e - b*d)
y = (a*f - c*d) / (a*e - b*d)
if x == -0.0:
x = 0
if y == -0.0:
y = 0
print('{:.3f} {:.3f}'.format(x, y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,372 |
s672588353 | p00004 | u179694829 | 1498971860 | Python | Python3 | py | Accepted | 20 | 7524 | 279 | while True:
try:
a,b,c,d,e,f = map(int,input().split())
except:
break
y = (c * d - a * f) / (b * d - a * e)
x = (c - b * y) / a
xs = str(round(x,3))
ys = str(round(y,3))
while xs[::-1].find(".") < 3:
xs += "0"
while ys[::-1].find(".") < 3:
ys += "0"
print(xs,ys) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,373 |
s656226146 | p00004 | u340500592 | 1499406211 | Python | Python3 | py | Accepted | 20 | 7360 | 236 | import sys
for line in sys.stdin:
a, b, c, d, e, f = map(float, line.split())
x = (c * e - f * b) / (a * e - d * b)
y = (c * d - f * a) / (b * d - e * a)
if x == 0:
x = 0
if y == 0:
y = 0
print('{0:.3f} {1:.3f}'.format(x, y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,374 |
s361707133 | p00004 | u600821328 | 1499865500 | Python | Python3 | py | Accepted | 20 | 7600 | 568 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import math
def my_round(x):
xx = 1000*x
f, i = math.modf(xx)
#print(f,i)
if f < 0.0 and f <= -0.5:
i -= 1
if f >= 0.0 and f >= 0.5:
i += 1
return i/1000 + 0
def main():
for line in sys.stdin:
a, b, c, d, e, f = map(float, line.split())
det = a*e - b*d
x = ( e*c - b*f) / det
y = (-d*c + a*f) / det
xr = my_round(x)
yr = my_round(y)
print("{:.3f} {:.3f}".format(xr, yr))
if __name__ == "__main__": main() | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,375 |
s623526338 | p00004 | u806182843 | 1500211205 | Python | Python3 | py | Accepted | 20 | 7492 | 381 | def main():
import sys
w = []
for line in sys.stdin:
w = list(map(float, line.split()))
solve(w)
def solve(w):
x = (w[2]*w[4]-w[1]*w[5]) / (w[0]*w[4]-w[1]*w[3])
y = (w[2]*w[3]-w[0]*w[5]) / (w[1]*w[3]-w[0]*w[4])
x = round(x, 3)
y = round(y, 3)
if x == -0.0:
x = 0.0
if y == -0.0:
y = 0.0
print('{0:.3f} {1:.3f}'.format(x, y))
if __name__ == '__main__':
main() | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,376 |
s907818293 | p00004 | u914146430 | 1500348129 | Python | Python3 | py | Accepted | 20 | 7592 | 179 | import sys
for line in sys.stdin:
a,b,c,d,e,f=list(map(int,line.split()))
x=(c*e-b*f)/(a*e-b*d)
y=(a*f-c*d)/(a*e-b*d)
print("{0:.3f} {1:.3f}".format(x+0.0,y+0.0)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,377 |
s293430305 | p00004 | u546285759 | 1500470884 | Python | Python3 | py | Accepted | 20 | 7636 | 191 | 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)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,378 |
s241150701 | p00004 | u503263570 | 1501138315 | Python | Python3 | py | Accepted | 20 | 7380 | 156 | import sys
for i in sys.stdin:
a,b,c,d,e,f=list(map(float,i.split()))
y=(d*c-a*f)/(d*b-a*e)+0
x=(e*c-b*f)/(e*a-d*b)+0
print("{:.3f} {:.3f}".format(x,y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,379 |
s991666702 | p00004 | u354053070 | 1501676280 | Python | Python3 | py | Accepted | 30 | 7272 | 224 | import sys
for line in sys.stdin:
a, b, c, d, e, f = list(map(float, line.split()))
x = (c * e - b * f) / (a * e - b * d)
y = (a * f - c * d) / (a * e - b * d)
print("{0:.3f} {1:.3f}".format(x + 0., y + 0.)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,380 |
s814046564 | p00004 | u267909338 | 1502803952 | Python | Python3 | py | Accepted | 20 | 7304 | 528 | try:
s = []
while True:
l = list(map(float, input().split()))
x = (l[2] * l[4] - l[5] * l[1]) / (l[0] * l[4] - l[3] * l[1])
y = (l[2] - l[0] * x) / l[1]
if x == -0 and y == -0:
x = abs(x)
y = abs(y)
elif x == -0:
x = abs(x)
elif y == -0:
y = abs(y)
else:
pass
x_2 = "{0:.3f}".format(x)
y_2 = "{0:.3f}".format(y)
print(str(x_2) + " " + str(y_2))
except EOFError:
pass | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,381 |
s056732007 | p00004 | u299798926 | 1502863170 | Python | Python3 | py | Accepted | 30 | 7604 | 226 | while 1:
try:
a,b,c,d,e,f=[int(i) for i in input().split()]
y=float((c*d-f*a)/(b*d-e*a))
x=float((c-b*y)/a)
print("{0:.3f}".format(x),"{0:.3f}".format(y))
except EOFError:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,382 |
s357702262 | p00004 | u234052535 | 1502896383 | Python | Python3 | py | Accepted | 20 | 7676 | 579 | # coding: utf-8
import sys
def Round(ip, dg): # ip????°???°?????\???dg?????§?????¨?????\????????¢??°
ip = ip * 10**dg
if(ip-int(ip) >= 0.5):
return (int(ip) + 1)/10**dg
else:
return int(ip)/10**dg
for i in sys.stdin:
try:
line = [int(k) for k in i.split(" ")]
a = line[0]
b = line[1]
c = line[2]
d = line[3]
e = line[4]
f = line[5]
print("{0:.03f}".format(Round((c*e-f*b)/(a*e-d*b), 3)) + " " + "{0:.03f}".format(Round((a*f-d*c)/(a*e-d*b), 3)))
except:
exit() | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,383 |
s623877348 | p00004 | u508732591 | 1503360491 | Python | Python3 | py | Accepted | 30 | 7312 | 180 | import sys
for s in list(sys.stdin):
a,b,e,c,d,f = list(map(float,s.split()))
base = a*d-b*c
x = e*d-b*f
y = a*f-e*c
print('%.3f %.3f' % (x/base+0,y/base+0)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,384 |
s223373738 | p00004 | u508732591 | 1503360498 | Python | Python3 | py | Accepted | 20 | 7352 | 180 | import sys
for s in list(sys.stdin):
a,b,e,c,d,f = list(map(float,s.split()))
base = a*d-b*c
x = e*d-b*f
y = a*f-e*c
print('%.3f %.3f' % (x/base+0,y/base+0)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,385 |
s044161515 | p00004 | u508732591 | 1503360587 | Python | Python3 | py | Accepted | 20 | 7344 | 172 | import sys
for s in list(sys.stdin):
a,b,e,c,d,f = map(float,s.split())
base = a*d-b*c
x = e*d-b*f
y = a*f-e*c
print('%.3f %.3f' % (x/base+0,y/base+0)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,386 |
s698913369 | p00004 | u193453446 | 1503459790 | Python | Python3 | py | Accepted | 20 | 7688 | 377 | import sys
def main():
""" ????????? """
istr = sys.stdin.read()
wi = istr.splitlines()
for i in wi:
a, b, c, d, e, f = list(map(int,i.split()))
z = (a * e - b * d)
x = round((c * e - b * f) / z, 3) + 0.0
y = round((a * f - c * d) / z, 3) + 0.0
print("{0:.3f} {1:.3f}".format(x,y))
if __name__ == '__main__':
main() | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,387 |
s587072865 | p00004 | u264972437 | 1503652091 | Python | Python3 | py | Accepted | 20 | 7720 | 280 | import sys
for line in sys.stdin.readlines():
#for line in data.split('\n'):
a,b,c,d,e,f = [int(s) for s in line.split()]
x = (c*e-b*f) / (a*e-b*d)
y = (c*d-a*f) / (b*d-a*e)
if round(x,3) == 0.0:
x = 0.0
if round(y,3) == 0.0:
y = 0.0
print('{0:.3f} {1:.3f}'.format(x,y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,388 |
s000800637 | p00004 | u428982301 | 1503885472 | Python | Python3 | py | Accepted | 20 | 7684 | 561 | import sys
def calc(a, b, c, d, e, f):
a2 = a * d
b2 = b * d
c2 = c * d
d2 = d * a
e2 = e * a
f2 = f * a
t1 = c2 - f2
t2 = b2 - e2
y = t1 / t2
x = (c - b * y) / a
return x, y
for line in sys.stdin:
datas =line.split()
if (len(datas)):
li = list(map(int, datas))
a = li[0]
b = li[1]
c = li[2]
d = li[3]
e = li[4]
f = li[5]
x, y = calc(a, b, c, d, e, f)
print("%.3f %.3f" % (round(x, 3), round(y, 3)))
else:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,389 |
s206216302 | p00004 | u957021183 | 1504683712 | Python | Python3 | py | Accepted | 30 | 7756 | 517 | # Aizu Problem 0004: Simultaneous Equation
#
import sys, math, os
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input2.txt", "rt")
for line in sys.stdin:
a, b, c, d, e, f = [int(_) for _ in line.split()]
det = a * e - b * d
det1 = c * e - b * f
det2 = a * f - c * d
#x = str(round(det1 / det, 3))
#y = str(round(det2 / det, 3))
x = det1 / det + 0
y = det2 / det + 0
#if -.001 < x < 0:
# x = 0
print("%.3f %.3f" % (x, y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,390 |
s398602737 | p00004 | u525269094 | 1505111328 | Python | Python3 | py | Accepted | 20 | 7508 | 273 |
import sys
import math
r = sys.stdin.readlines()
n = [[float(i) for i in (j.split())] for j in r]
for l in n:
y = (l[2]*l[3]-l[0]*l[5])/(l[1]*l[3]-l[0]*l[4])+0
x = (l[2]*l[4]-l[5]*l[1])/(l[0]*l[4]-l[3]*l[1])+0
print("%.3f %.3f" %(x, y))
| p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,391 |
s052459205 | p00004 | u184989919 | 1505656349 | Python | Python3 | py | Accepted | 20 | 7428 | 259 | import sys
def SimultaneousEquation():
for line in sys.stdin:
a,b,c,d,e,f=map(float,line.split())
y=(c*d-f*a)/(b*d-e*a)
x=(c-b*y)/a
print("{0:.3f} {1:.3f}".format(x,y))
#testWriteFile()
SimultaneousEquation() | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,392 |
s496501281 | p00004 | u741801763 | 1505726356 | Python | Python3 | py | Accepted | 30 | 7580 | 394 | import fileinput as fi
if __name__ == "__main__":
for line in fi.input():
a,b,c,d,e,f = list(map(int,line.strip().split()))
x1 = (c*e -b*f)
x2= (a*e - b*d)
if x2< 0:
x1 = -x1
x2= -x2
y1 = (c*d - a*f)
y2= (b*d - a*e)
if y2 <0:
y1= -y1
y2 = -y2
print("%.3f %.3f" % (x1/x2,y1/y2)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,393 |
s282262862 | p00004 | u933096856 | 1505795719 | Python | Python3 | py | Accepted | 20 | 7464 | 317 | try:
while True:
a,b,c,d,e,f=map(float, input().split())
x=(c*e-b*f)/(a*e-b*d)
y=(a*f-c*d)/(a*e-b*d)
if x==0:
x=0
if y==0:
y=0
x=round(x,3)
y=round(y,3)
print("{0:.3f}".format(x),"{0:.3f}".format(y))
except EOFError:
pass | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,394 |
s542045700 | p00004 | u933096856 | 1505795741 | Python | Python3 | py | Accepted | 20 | 7400 | 317 | try:
while True:
a,b,c,d,e,f=map(float, input().split())
x=(c*e-b*f)/(a*e-b*d)
y=(a*f-c*d)/(a*e-b*d)
if x==0:
x=0
if y==0:
y=0
x=round(x,3)
y=round(y,3)
print("{0:.3f}".format(x),"{0:.3f}".format(y))
except EOFError:
pass | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,395 |
s343214858 | p00004 | u933096856 | 1505795799 | Python | Python3 | py | Accepted | 20 | 7344 | 294 | try:
while True:
a,b,c,d,e,f=map(float, input().split())
x=(c*e-b*f)/(a*e-b*d)
y=(a*f-c*d)/(a*e-b*d)
if x==0:
x=0
if y==0:
y=0
print("{0:.3f}".format(round(x,3)), "{0:.3f}".format(round(y,3)))
except EOFError:
pass | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,396 |
s234199089 | p00004 | u933096856 | 1505796012 | Python | Python3 | py | Accepted | 30 | 7448 | 294 | try:
while True:
a,b,c,d,e,f=map(float, input().split())
x=(c*e-b*f)/(a*e-b*d)
y=(a*f-c*d)/(a*e-b*d)
if x==0:
x=0
if y==0:
y=0
print("{0:.3f}".format(round(x,3)), "{0:.3f}".format(round(y,3)))
except EOFError:
pass | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,397 |
s740060180 | p00004 | u197615397 | 1506155299 | Python | Python3 | py | Accepted | 20 | 7716 | 209 | import sys
for line in sys.stdin:
a, b, c, d, e, f = map(int, line.split())
n1, n2 = -b/a*d, c/a*d
n1 += e
n2 = -n2 + f
y = n2/n1
x = (c - b*y)/a
print("{:.3f} {:.3f}".format(x, y)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,398 |
s560434206 | p00004 | u742505495 | 1507698951 | Python | Python3 | py | Accepted | 30 | 7592 | 284 | import math
import sys
while True:
try:
a,b,c,d,e,f = map(float, input().split())
if a*e == b*d:
continue
x = (c*e - b*f)/(a*e - b*d)
y = (c*d - a*f)/(b*d - a*e)
if x == 0:
x = 0
if y == 0:
y = 0
print('{0:.3f} {1:.3f}'.format(x,y))
except EOFError:
break | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,399 |
s397887573 | p00004 | u197670577 | 1508246313 | Python | Python | py | Accepted | 10 | 6320 | 380 | from __future__ import division
import sys
# ad*x + bd*y = cd
# -)ad*x + ae*y = af
# (bd-ae)*y = cd-af
# and so on...
while True:
try:
a, b, c, d, e, f = map(float, raw_input().split())
except:
break
x = (c*e - b*f) / (a*e - b*d) + 0 # -0 towa...
y = (c*d - a*f) / (b*d - a*e) + 0
print "{:.3f} {:.3f}".format(round(x,3), round(y,3)) | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,400 |
s528969302 | p00004 | u926657458 | 1508958373 | Python | Python3 | py | Accepted | 20 | 7648 | 360 | import sys
d = sys.stdin.readline()
while d:
a,b,c,d,e,f = map(int,d.split())
inv = 1/(a*e - b*d)
iA = [[e,-b],[-d,a]]
B = [c,f]
sol = list()
for i in range(2):
tmp = 0
for j in range(2):
tmp += inv*iA[i][j] * B[j]
sol.append(tmp)
print("%.3f %.3f"%(sol[0],sol[1]))
d = sys.stdin.readline() | p00004 |
<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 ≤ <var>a, b, c, d, e, f</var> ≤ 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>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,401 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.