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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s456368745
|
p00004
|
u424041287
|
1509111400
|
Python
|
Python3
|
py
|
Accepted
| 30
|
7712
| 229
|
t = 0
while t == 0:
try:
a,b,e,c,d,f = [int(i) for i in input().split()]
except:
break
else:
x = (d*e - b*f) / (a*d - b*c) + 0
y = (a*f - c*e) / (a*d - b*c) + 0
print("{0:.3f}".format(x) + " " + "{0:.3f}".format(y))
|
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,402
|
s927816641
|
p00004
|
u914007790
|
1509345402
|
Python
|
Python3
|
py
|
Accepted
| 30
|
7628
| 273
|
x = []
y = []
while True:
try:
a, b, p, c, d, q = map(int, input().split())
x.append((d*p-b*q)/(a*d-b*c))
y.append((a*q-c*p)/(a*d-b*c))
except EOFError:
break
for i in range(len(x)):
print("{:.3f} {:.3f}".format(x[i]+0, y[i]+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,403
|
s161556265
|
p00004
|
u123686770
|
1509512059
|
Python
|
Python
|
py
|
Accepted
| 10
|
6388
| 291
|
while True:
try:
data = raw_input()
except EOFError:
break
a,b,c,d,e,f = map(float, data.split())
x = ( b*f - e*c ) / ( b*d - a*e )
y = ( c*d - a*f ) / ( b*d - a*e )
if x == -0.0:
x = 0
if y == -0.0:
y = 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,404
|
s638668449
|
p00004
|
u776758454
|
1510651369
|
Python
|
Python3
|
py
|
Accepted
| 80
|
10072
| 911
|
import sys
from decimal import Decimal
from fractions import Fraction
def main():
input_strings = sys.stdin.readlines()
for matrix_string in input_strings:
matrix = list(map(Fraction, list(matrix_string.split())))
if matrix[0] == 0:
matrix = matrix[3:] + matrix[:3]
matrix = list(map(lambda x: x / matrix[0], matrix[:3])) + matrix[3:]
matrix = matrix[:3] + list(map(lambda x: x[1] - matrix[3] * x[0], zip(matrix[:3], matrix[3:])))
matrix = matrix[:3] + list(map(lambda x: x / matrix[4], matrix[3:]))
matrix = list(map(lambda x: x[0] - matrix[1] * x[1], zip(matrix[:3], matrix[3:]))) + matrix[3:]
matrix = list(map(float, matrix))
matrix = list(map(Decimal, matrix))
matrix = list(map(lambda x: x.quantize(Decimal('.001'), rounding='ROUND_HALF_UP'), matrix))
print('%.3f %.3f' % (matrix[2], matrix[5]))
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,405
|
s948776140
|
p00004
|
u917432951
|
1510714422
|
Python
|
Python3
|
py
|
Accepted
| 50
|
7492
| 304
|
import sys
import math
def simeq(a,b,c,d,e,f):
return ((c*e-b*f)/(a*e-b*d)+0,((a*f-c*d)/(a*e-b*d))+0)
if __name__ == '__main__':
for line in sys.stdin:
(a,b,c,d,e,f) = map(float,line.split())
(x,y) = simeq(a,b,c,d,e,f)
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,406
|
s687709927
|
p00004
|
u742178809
|
1511328981
|
Python
|
Python3
|
py
|
Accepted
| 20
|
7448
| 240
|
import sys
#from me.io import dup_file_stdin
#@dup_file_stdin
def solve():
for line in sys.stdin:
a,b,c,d,e,f=map(float,line.split(' '))
print("{:.3f} {:.3f}".format((c*e-b*f)/(a*e-b*d)+0,(c*d-a*f)/(b*d-a*e)+0))
solve()
|
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,407
|
s741270183
|
p00004
|
u319774425
|
1511859235
|
Python
|
Python
|
py
|
Accepted
| 0
|
4704
| 691
|
while 1:
def solver(a, b, c, d, e, f):
answer = []
if d == 0:
y = f / e
x = (c - b * y)/a
else:
m = a / d
d = d * m
e = e * m
f = f * m
y = (c - f)/(b - e)
x = (c - b * y)/a
if x == -0:
x = 0
if y == -0:
y = 0
answer.append(x)
answer.append(y)
return answer
try:
p_1, p_2, p_3, p_4, p_5, p_6 = map(float, raw_input().split())
ans = []
ans = solver(p_1, p_2, p_3, p_4, p_5, p_6)
print "%.3f %.3f" % (ans[0], ans[1])
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,408
|
s750501911
|
p00004
|
u548155360
|
1512380868
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5584
| 497
|
# coding=utf-8
while True:
try:
number_list = list(map(float, input().split()))
except EOFError:
break
det = number_list[0]*number_list[4] - number_list[1]*number_list[3]
inverse_list = [number_list[4] / det, -number_list[1] / det, -number_list[3] / det, number_list[0] / det]
x = inverse_list[0]*number_list[2] + inverse_list[1]*number_list[5]
y = inverse_list[2]*number_list[2] + inverse_list[3]*number_list[5]
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,409
|
s044136033
|
p00004
|
u024715419
|
1513245301
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5584
| 224
|
while True:
try:
a, b, c, d, e, f = map(float, input().split())
x = (c*e - b*f)/(a*e - b*d)
y = (f*a - c*d)/(a*e - d*b)
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,410
|
s190889818
|
p00004
|
u846136461
|
1513435079
|
Python
|
Python
|
py
|
Accepted
| 10
|
4700
| 371
|
# coding: utf-8
while True:
try:
data = map(int, raw_input().split())
a = data[0]
b = data[1]
c = data[2]
d = data[3]
e = data[4]
f = data[5]
x = (c*e-b*f)*1.0 / (a*e-b*d)
if x == -0.000:
x = 0.000
if b != 0:
y = (c-a*x)/b
else:
y = (f-d*x)/e
if y == -0.000:
y = 0.000
print("{:.3f} {:.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,411
|
s285868423
|
p00004
|
u546285759
|
1513855919
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5612
| 207
|
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,412
|
s540429932
|
p00004
|
u480287988
|
1514095912
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5580
| 298
|
import sys
#import numpy as np
for i in sys.stdin:
a,b,c,d,e,f=list(map(float, i.split()))
#A=np.matrix([[a,b],[d,e]])
#inv_A = np.linalg.inv(A)
#P=np.matrix([[c],[f]])
#X=inv_A.dot(P)
y = (f-(d*c)/a)/((a*e-d*b)/a)
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,413
|
s496433823
|
p00004
|
u764789069
|
1514120960
|
Python
|
Python
|
py
|
Accepted
| 0
|
4676
| 330
|
while True:
try:
a,b,c,d,e,f=map(int,raw_input().split())
if a*d-b*c==0:
print "not exist answer"
else:
x = (float((c*e-b*f)) / (a*e-b*d))+0
y = (float((a*f-c*d)) / (a*e-b*d))+0
print ('%.3f' % round(x,3)), ('%.3f' % 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,414
|
s714063298
|
p00004
|
u183079216
|
1514208136
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5616
| 208
|
while 1:
try:
s=input()
a,b,c,d,e,f = [int(x) for x in s.split()]
y = (d*c-a*f)/(b*d-a*e)
x = (c-b*y)/a
print('{:.3f} {:.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,415
|
s694194888
|
p00004
|
u028347703
|
1514531905
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5624
| 470
|
import sys
def det(mat):
t = 1 / (mat[0][0] * mat[1][1] - mat[0][1] * mat[1][0])
a = t * mat[1][1]
b = t * -1 * mat[0][1]
c = t * -1 * mat[1][0]
d = t * mat[0][0]
return [[a, b], [c, d]]
for line in sys.stdin:
try:
a, b, c, d, e, f = [int(i) for i in line.split()]
A = [[a, b], [d, e]]
P = [c, f]
detA = det(A)
print("%.3lf %.3lf" % (detA[0][0] * P[0] + detA[0][1] * P[1], detA[1][0] * P[0] + detA[1][1] * P[1]))
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,416
|
s247704358
|
p00004
|
u706217959
|
1514688788
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5660
| 1,270
|
import math
def my_round(x,d=0):
p = 10 ** d
return float(math.floor((x * p) + math.copysign(0.5, x))) / p
class Equation():
def __init__(self, a, b, c, d, e, f):
self.a = a
self.b = b
self.c = c
self.d = d
self.e = e
self.f = f
def calc(self):
temp = (self.a * self.e - self.b * self.d)
temp_a = (self.c * self.e - self.b * self.f)
temp_b = (self.a * self.f - self.c * self.d)
try:
x = round(temp_a / temp+0., 3)
except ZeroDivisionError:
x = round(temp_a / 1.0, 4)
try:
y = round(temp_b / temp+0., 3)
except:
y = round(temp_b / 1.0, 4)
return x, y
def print(self):
ans = self.calc()
print("{0:.3f} {1:.3f}".format(ans[0], ans[1]))
def main():
data = []
while 1:
try:
n = input().split()
a = float(n[0])
b = float(n[1])
c = float(n[2])
d = float(n[3])
e = float(n[4])
f = float(n[5])
data.append(Equation(a, b, c, d, e, f))
except EOFError:
break
for num in data:
num.print()
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,417
|
s415131859
|
p00004
|
u273843182
|
1514716498
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5588
| 188
|
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,418
|
s478622994
|
p00004
|
u183224403
|
1515194461
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5588
| 314
|
while True:
try:
input_line = input()
if input_line == '':
break
else:
a, b, c, d, e, f = map(float, input_line.split())
x = (b*f-c*e) / (b*d-a*e)
y = (c-a*x)/b
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,419
|
s391892590
|
p00004
|
u043254318
|
1516196461
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5584
| 331
|
def get_input():
while True:
try:
yield ''.join(input())
except EOFError:
break
N = list(get_input())
for l in range(len(N)):
a,b,c,d,e,f = [float(i) for i in N[l].split()]
x = (c*e-f*b)/(a*e-b*d)
y = (f*a-c*d)/(a*e-b*d)
print(format(x+0.0,'.3f'), format(y+0.0,'.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,420
|
s916784123
|
p00004
|
u150984829
|
1516550576
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5612
| 131
|
import sys
for e in sys.stdin:
a,b,c,d,e,f=map(int,e.split())
print("%-.3f %-.3f"%((c*e-b*f)/(a*e-b*d)+0,(c*d-a*f)/(b*d-a*e)+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,421
|
s963872329
|
p00004
|
u150984829
|
1516550717
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5612
| 129
|
import sys
for e in sys.stdin:
a,b,c,d,e,f=map(int,e.split())
print("%.3f %.3f"%((c*e-b*f)/(a*e-b*d)+0,(c*d-a*f)/(b*d-a*e)+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,422
|
s111529697
|
p00004
|
u150984829
|
1516550868
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5612
| 120
|
import sys
for e in sys.stdin:
a,b,c,d,e,f=map(int,e.split())
y=(c*d-a*f)/(b*d-a*e)
print("%.3f %.3f"%((c-b*y)/a,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,423
|
s414055383
|
p00004
|
u803045841
|
1516561796
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5620
| 211
|
import sys
for e in sys.stdin:
a, b, c, d, e, f = map(int, e.split())
y=(c*d-a*f)/(b*d-a*e)
x = (c-b*y)/a
#print (str(round(x, 3))+' '+str(round(y, 3)))#dont int+str
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,424
|
s917209378
|
p00004
|
u536089081
|
1517566434
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5580
| 320
|
from sys import stdin
for line in stdin:
a, b, c, d, e, f = map(float, line.split())
anss = ['%.3f' % ((c * e - f * b) / (a * e - b * d)), '%.3f' % ((c * d - a * f) / (b * d - a * e))]
for index, ans in enumerate(anss):
if ans == '-0.000':
anss[index] = '0.000'
print(' '.join(anss))
|
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,425
|
s702513984
|
p00004
|
u780025254
|
1519184272
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5584
| 192
|
while True:
try:
a, b, c, d, e, f = map(float, 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,426
|
s556863963
|
p00004
|
u780025254
|
1519185172
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5584
| 226
|
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}".format(x+0.0, y+0.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,427
|
s232814476
|
p00004
|
u553148578
|
1519817592
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5612
| 150
|
while True:
try:
a,b,c,d,e,f = map(int, input().split())
x = (c*d-a*f)/(b*d-a*e)
print("{:.3f} {:.3f}".format((c-b*x)/a, x))
except:
break
|
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,428
|
s967652654
|
p00004
|
u027874809
|
1523845750
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5584
| 346
|
while True:
try:
(a, b, e, c, d, f) = map(float, input().split())
D = a * d - b * c
x = (d * e - b * f) / D
y = (a * f - c * e) / D
if abs(x) < 1e-4:
x = 0.0
if abs(y) < 1e-4:
y = 0.0
print("{0:.3f} {1:.3f}".format(x, y))
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,429
|
s479833287
|
p00004
|
u533681846
|
1525023363
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5584
| 191
|
while 1:
try:
a,b,c,d,e,f = map(float, input().split())
y=(c*d-a*f)/(b*d-a*e)
x=(c-b*y)/a
print("{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,430
|
s153475773
|
p00004
|
u223900719
|
1525065386
|
Python
|
Python
|
py
|
Accepted
| 10
|
4672
| 207
|
while True:
try:
a,b,c,d,e,f=map(int,raw_input().split())
y=round( float(c*d-f*a)/(b*d-a*e) ,3)
x=round( float(c-b*y)/a , 3)
print("{:.3f}".format(x)),("{:.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,431
|
s750030173
|
p00004
|
u150984829
|
1525317621
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5632
| 121
|
import sys
for e in sys.stdin:
a,b,c,d,e,f=map(int,e.split())
y=(c*d-a*f)/(b*d-a*e)
print(f'{(c-b*y)/a:.3f} {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,432
|
s175281467
|
p00004
|
u724548524
|
1525731009
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5620
| 278
|
import sys
for i in sys.stdin:
a, b, c, d, e, f = map(int, i.split())
x = (c * e - b * f) / (a * e - b * d)
y = (c * d - a * f) / (b * d - a * e)
x = abs(x) if abs(x) < 10e-4 else x
y = abs(y) if abs(y) < 10e-4 else y
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,433
|
s667687067
|
p00004
|
u802537549
|
1526805683
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5620
| 282
|
while True:
try:
a, b, c, d, e, f = [int(i) for i in input().split()]
detA = a * e - b * d
detA1 = c * e - b * f
detA2 = a * f - c * d
print('{:.3f} {:.3f}'.format(detA1 / detA + 0, detA2 / detA + 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,434
|
s776502563
|
p00004
|
u986478725
|
1527570277
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5616
| 1,144
|
# Vol0004.
import sys
def main():
data = []
lines = sys.stdin.readlines()
for line in lines:
data.append(line.split()) # スペース区切りで放り込む
# ax + by = c, dx + ey = fの解は、
# x = (ce - bf) / (ae - bd), y = (af - cd) / (ae - bd).
# これをround(float, 3)すれば答えが出る。
N = len(data)
for i in range(N):
for k in range(6):
data[i][k] = int(data[i][k])
det = data[i][0] * data[i][4] - data[i][1] * data[i][3]
gx = data[i][2] * data[i][4] - data[i][1] * data[i][5]
gy = data[i][0] * data[i][5] - data[i][2] * data[i][3]
if det < 0:
det = -det;
if gx != 0: gx = -gx
if gy != 0: gy = -gy
print("{0:.3f}".format(gx / det) + " " + "{0:.3f}".format(gy / det))
if __name__ == "__main__":
main()
# 補足、0.1とか0.22でも3桁目まで表示しないとWrongになる。
# 表示するにはprint("{0:.nf}".format(数))ってやる(nのところは桁数)。
# さらに、0を負の数で割ると表示が-0.000になってしまうのでそこの処理も重要。
|
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,435
|
s555983689
|
p00004
|
u002010345
|
1527685346
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5588
| 354
|
def main():
while 1:
try:
p = [float(x) for x in input().split()]
x = (p[4]*p[2]-p[1]*p[5])/(p[0]*p[4]-p[1]*p[3])
y = (p[2]-p[0]*x)/p[1]
except:
break
if abs(x)<1e-4:
x=0.0
if abs(y)<1e-4:
y=0.0
print("{:.3f} {:.3f}".format(x,y))
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,436
|
s453135163
|
p00004
|
u847467233
|
1528512739
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5584
| 293
|
# AOJ 0004 Simultaneous Equation
# Python3 2018.6.9 bal4u
EPS = 0.0001
while True:
try:
a = list(map(float, input().split()))
dd = a[0]*a[4]-a[3]*a[1]
d1 = a[2]*a[4]-a[5]*a[1]
d2 = a[0]*a[5]-a[3]*a[2]
print("{0:.3f} {1:.3f}".format(d1/dd+EPS, d2/dd+EPS))
except EOFError:
break
|
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,437
|
s988305263
|
p00004
|
u563075864
|
1529161791
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5600
| 238
|
import sys
for line in sys.stdin:
a,b,c,d,e,f = [float(i) for i in line.split()]
x = round((1/a)*(c-b*((a*f-c*d)/(a*e-b*d))),3)
y = round((a*f-c*d)/(a*e-b*d),3)
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,438
|
s395360798
|
p00004
|
u316584871
|
1530004787
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5612
| 260
|
while True:
try:
a,b,c,d,e,f = map(int, input().split())
g = (a*e - b*d)
x = (c*e - b*f)
y = (a*f - c*d)
print('{0:.3f}'.format(x/g+0.0001) +' {0:.3f}'.format(y/g +0.0001))
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,439
|
s374367652
|
p00004
|
u995990363
|
1530672179
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5636
| 590
|
import sys
def inv(k):
det = 1 / (k[0]*k[3] - k[1]*k[2])
ret = [k[3] * det, -k[1] * det, -k[2] * det, k[0] * det]
return ret
def dot(i, j):
x = i[0] * j[0] + i[1] * j[1]
y = i[2] * j[0] + i[3] * j[1]
return [x,y]
def run():
data = []
for _data in sys.stdin:
data.append(list(map(int, _data.split())))
for _data in data:
i = _data[:2] + _data[3:5]
j = [_data[2],_data[5]]
x, y = dot(inv(i), j)
x, y = round(x, 3), round(y, 3)
print('{0:.3f} {1:.3f}'.format(x,y))
if __name__ == '__main__':
run()
|
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,440
|
s701988011
|
p00004
|
u263247628
|
1344571805
|
Python
|
Python
|
py
|
Accepted
| 10
|
4260
| 325
|
while True:
try:
x = map(float, raw_input().split(" "))
a = (x[2]*x[4]-x[1]*x[5])/(x[0]*x[4]-x[1]*x[3])
b = (-x[3]*x[2]+x[0]*x[5])/(x[0]*x[4]-x[1]*x[3])
if a == -0: a = 0
if b == -0: b = 0
print "%.3f %.3f" % (a, b)
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,441
|
s744591777
|
p00004
|
u894941280
|
1344732526
|
Python
|
Python
|
py
|
Accepted
| 10
|
4256
| 328
|
while True:
try:
x = map(float, raw_input().split(" "))
a = (x[2]*x[4]-x[1]*x[5])/(x[0]*x[4]-x[1]*x[3])
b = (-x[3]*x[2]+x[0]*x[5])/(x[0]*x[4]-x[1]*x[3])
if a == -0: a = 0
if b == -0: b = 0
print "%.3f %.3f" % (a, b)
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,442
|
s542955248
|
p00004
|
u891318575
|
1346473835
|
Python
|
Python
|
py
|
Accepted
| 10
|
4388
| 420
|
# -*- coding: utf-8 -*-
import math
while True:
try:
list = [float(x) for x in raw_input().split(" ")]
x = (list[2]*list[4]-list[1]*list[5])/(list[0]*list[4]-list[1]*list[3])
y = (list[0]*list[5]-list[2]*list[3])/(list[0]*list[4]-list[1]*list[3])
if x == -0:
x = 0
if y == -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,443
|
s721336230
|
p00004
|
u724947062
|
1346481213
|
Python
|
Python
|
py
|
Accepted
| 20
|
4248
| 320
|
import sys
def calc(a, b, c, d, e, f):
tmp = a * e - b * d
x = c * (e / tmp) + f * (-b / tmp)
y = c * (-d / tmp) + f * (a / tmp)
return (x, y)
for i in sys.stdin.readlines():
i = i.strip()
a, b, c, d, e, f = map(float, i.split())
print "{0[0]:.3f} {0[1]:.3f}".format(calc(a, b, c, d, e, f))
|
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,444
|
s699742548
|
p00004
|
u126791750
|
1350214640
|
Python
|
Python
|
py
|
Accepted
| 10
|
4264
| 343
|
#coding:UTF-8
while(True):
try:
n = map(float, raw_input().split())
x = (n[2]*n[4] - n[5]*n[1]) / (n[0]*n[4] - n[3]*n[1])
y = (n[2]*n[3] - n[5]*n[0]) / (n[1]*n[3] - n[4]*n[0])
if x==-0:
x=0
if y==-0:
y=0
print "%.3f %.3f"%(x,y)
except Exception:
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,445
|
s084173965
|
p00004
|
u647766105
|
1350909318
|
Python
|
Python
|
py
|
Accepted
| 20
|
4360
| 172
|
import sys
import math
for i in sys.stdin.readlines():
a,b,p,c,d,q= map(float, i.split())
print "{:.3f} {:.3f}".format((d*p-b*q)/(a*d-b*c)+0,(-c*p+a*q)/(a*d-b*c)+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,446
|
s688395752
|
p00004
|
u719737030
|
1350911709
|
Python
|
Python
|
py
|
Accepted
| 20
|
5948
| 199
|
import sys
for x in sys.stdin.readlines():
n = [float(y) for y in x.split()]
print "%.3f %.3f" % ((n[2]*n[4]-n[1]*n[5])/(n[0]*n[4]-n[1]*n[3])+0,(n[5]*n[0]-n[2]*n[3])/(n[0]*n[4]-n[3]*n[1])+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,447
|
s469943504
|
p00004
|
u779627195
|
1352372327
|
Python
|
Python
|
py
|
Accepted
| 20
|
4260
| 342
|
#coding: utf-8
def solve(a, b, c, d, e, f):
agn = a*e - b*d
x = (e*c - b*f)/float(agn)
y = (-d*c + a*f)/float(agn)
if x == 0.: x = 0.
if y == 0.: y = 0.
print "%.3f %.3f" % (x, y)
while 1:
try:
a,b,c,d,e,f = map(float, raw_input().split())
solve(a,b,c,d,e,f)
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,448
|
s293243789
|
p00004
|
u504990413
|
1352986640
|
Python
|
Python
|
py
|
Accepted
| 10
|
5016
| 328
|
while True:
try:
x = map(float, raw_input().split(" "))
a = (x[2]*x[4]-x[1]*x[5])/(x[0]*x[4]-x[1]*x[3])
b = (-x[3]*x[2]+x[0]*x[5])/(x[0]*x[4]-x[1]*x[3])
if a == -0: a = 0
if b == -0: b = 0
print "%.3f %.3f" % (a, b)
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,449
|
s809019642
|
p00004
|
u504990413
|
1352987105
|
Python
|
Python
|
py
|
Accepted
| 10
|
5016
| 333
|
while True:
try:
a = map(float, raw_input().split(' '))
x = (a[1]*a[5]-a[2]*a[4])/(a[1]*a[3]-a[0]*a[4])
y = (a[2]*a[3]-a[0]*a[5])/(a[1]*a[3]-a[0]*a[4])
if x == 0:
x = abs(x)
if y == 0:
y = abs(y)
print '%.3f %.3f' % (x,y)
except EOFError:
break
|
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,450
|
s677480116
|
p00004
|
u419407022
|
1355295593
|
Python
|
Python
|
py
|
Accepted
| 20
|
5268
| 250
|
while True:
try:
a, b, c, d, e, f = map(float, raw_input().split())
except EOFError:
break
x = (e * c - b * f) / (a * e - b * d)
y = (-d * c + a * f) / (a * e - b * d)
print '%.3f %.3f' % (x + 0.00001, y + 0.00001)
|
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,451
|
s542315085
|
p00004
|
u782850731
|
1361770192
|
Python
|
Python
|
py
|
Accepted
| 10
|
4288
| 420
|
from __future__ import (division, absolute_import, print_function,
unicode_literals)
import sys
for line in sys.stdin:
a, b, c, d, e, f = (float(n) for n in line.split())
x = round((e * c - b * f) / (a * e - b * d), 4)
y = round((a * f - c * d) / (a * e - b * d), 4)
if x == -0.0:
x = 0.0
if y == -0.0:
y = 0.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,452
|
s984860932
|
p00004
|
u246394513
|
1362332808
|
Python
|
Python
|
py
|
Accepted
| 20
|
4252
| 141
|
try:
for r in iter(raw_input,0):a,b,c,d,e,f=map(float,r.split());g=a*e-b*d;print "%.3f %.3f"%((c*e-b*f)/g+1e-9,(a*f-c*d)/g+1e-9)
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,453
|
s226873994
|
p00004
|
u282635979
|
1363863017
|
Python
|
Python
|
py
|
Accepted
| 20
|
4268
| 286
|
while True:
try:
a,b,c,d,e,f = map(float,raw_input().split(' '))
p = round((c*e-b*f)/(a*e-b*d),4)
q = round((a*f-c*d)/(a*e-b*d),4)
x = '%.3f' % p
y = '%.3f' % q
if str(x) == '-0.000': x = '%.3f' % 0.000
if str(y) == '-0.000': y = '%.3f' % 0.000
print 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,454
|
s338635819
|
p00004
|
u585414111
|
1365343320
|
Python
|
Python
|
py
|
Accepted
| 10
|
4252
| 208
|
import sys
for line in sys.stdin:
[a,b,c,d,e,f] = [float(x) for x in line.split()]
x = (f-(c/b*e))/(d-(a/b*e))
y = (f-(c/a*d))/(e-(b/a*d))
print "%.3f %.3f" % (x if x else 0.0,y if y else 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,455
|
s345262063
|
p00004
|
u318424563
|
1366698092
|
Python
|
Python
|
py
|
Accepted
| 10
|
4264
| 420
|
data = []
try:
while True:
data.append(raw_input())
except EOFError:
pass
for i in data:
a, b, c, d, e, f = map(float, (i.split()))
if (abs(a) <= 1000
and abs(b) <= 1000
and abs(c) <= 1000
and abs(d) <= 1000
and abs(e) <= 1000
and abs(f) <= 1000):
y = (a*f - c*d) / (a*e - b*d)
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,456
|
s660396868
|
p00004
|
u350508326
|
1367942997
|
Python
|
Python
|
py
|
Accepted
| 10
|
4256
| 292
|
while True:
try:
a = map(float,raw_input().split())
m = a[0]*a[4]-a[1]*a[3]
x = (a[4]*a[2] - a[1]*a[5])/m
y = (a[0]*a[5] - a[2]*a[3])/m
if x == -0:
x = 0
if y == -0:
y = 0
print "%.3f %.3f" % (x,y)
except EOFError:
break
|
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,457
|
s373718770
|
p00004
|
u536245846
|
1374656946
|
Python
|
Python
|
py
|
Accepted
| 20
|
4252
| 307
|
while True:
try:
a, b, c, d, e, f = map(float, raw_input().split())
a1 = (c*e-b*f)/(a*e-b*d)
a2 = (a*f-c*d)/(a*e-b*d)
if a1 == -0:
a1 = 0
if a2 == -0:
a2 = 0
print "{0:.3f} {1:.3f}".format(a1, a2)
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,458
|
s680106382
|
p00004
|
u843960735
|
1374701997
|
Python
|
Python
|
py
|
Accepted
| 20
|
4236
| 167
|
try :
while True :
(a,b,c,d,e,f) = map(float, raw_input().split())
print "%.3f %.3f"%((c*e-b*f)/(a*e-b*d)+0, (a*f-c*d)/(a*e-b*d)+0)
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,459
|
s097722022
|
p00004
|
u085789778
|
1374771112
|
Python
|
Python
|
py
|
Accepted
| 10
|
4256
| 302
|
# -*- coding:utf-8 -*-
if __name__ == '__main__':
while True:
try:
a, b, c, d, e, f = [float(num) for num in raw_input().split()]
x = ((e*c)-(b*f))/((e*a)-(b*d))
y = ((d*c)-(a*f))/((d*b)-(a*e))
except:
break
if(x==-0):
x=0
if(y==-0):
y=0
print '%0.3f %0.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,460
|
s508021830
|
p00004
|
u912573907
|
1375168556
|
Python
|
Python
|
py
|
Accepted
| 20
|
4304
| 1,008
|
import sys
def gcd(a, b):
return gcd(b, a % b) if a % b else b
def lcm(a, b):
return a * b / gcd(a, b)
for line in sys.stdin:
data = map(int, line.split())
a, b, c, d, e, f = data
if a == 0:
y = c * 1.0 / b
x = (f - e * y) * 1.0 / d
print "%.3f %.3f" % (round(x, 4), round(y, 4))
continue
if b == 0:
x = c * 1.0 / a
y = (f - d * x) * 1.0 / e
print "%.3f %.3f" % (round(x, 4), round(y, 4))
continue
if d == 0:
y = f * 1.0 / e
x = (c - b * y) * 1.0 / a
print "%.3f %.3f" % (round(x, 4), round(y, 4))
continue
if e == 0:
x = f * 1.0 / d
y = (c - a * x) * 1.0 / b
print "%.3f %.3f" % (round(x, 4), round(y, 4))
continue
ix = lcm(a, d) / a
jx = lcm(a, d) / d
iy = lcm(b, e) / b
jy = lcm(b, e) / e
x = (c*1.0*iy - f*jy) / (a*iy - d*jy)
y = (c*1.0*ix - f*jx) / (b*ix - e*jx)
print "%.3f %.3f" % (round(x, 4), round(y, 4))
|
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,461
|
s653030774
|
p00004
|
u455025374
|
1376080435
|
Python
|
Python
|
py
|
Accepted
| 20
|
4236
| 132
|
import sys
for i in sys.stdin:
a,b,c,d,e,f=map(int,i.split())
y=(d*c-a*f)*1.0/(d*b-a*e);
print "%.3f %.3f"%((c-b*y)/a,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,462
|
s500632072
|
p00004
|
u912237403
|
1376722280
|
Python
|
Python
|
py
|
Accepted
| 10
|
4288
| 621
|
def inverse(x):
if len(x)!=2: return []
a, b = x[0]
c, d = x[1]
tmp = 1.0/(a*d-b*c)
return [[d*tmp, -b*tmp],[-c*tmp, a*tmp]]
def Mmult(A, B):
n1=len(A)
n2=len(A[0])
n3=len(B[0])
C=[[0 for j in range(n3)] for i in range(n1)]
for i in range(n1):
for j in range(n2):
for k in range(n3):
C[i][k] += A[i][j] * B[j][k]
return C
while True:
try:
x = map(int, raw_input().split())
except:
break
A=[x[0:2], x[3:5]]
B=[[x[2]], [x[5]]]
C = Mmult(inverse(A), B)
print "%.3f %.3f" %(C[0][0], C[1][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,463
|
s919593081
|
p00004
|
u813384600
|
1379307536
|
Python
|
Python
|
py
|
Accepted
| 20
|
4240
| 231
|
while True:
try:
(a,b,c,d,e,f) = map(float, raw_input().split())
y = (a * f - c * d) / (-b * d + e * a)
x = (c - b * y) / a
print '{0:.3f} {1:.3f}'.format(x, y)
except EOFError:
break
|
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,464
|
s014526561
|
p00004
|
u389390219
|
1380934993
|
Python
|
Python
|
py
|
Accepted
| 10
|
4244
| 146
|
while True:
try:
a,b,c,d,e,f=map(float,raw_input().split())
y=(d*c-a*f)*1.0/(d*b-a*e)
print "%.3f %.3f"%((c-b*y)/a,y)
except:break
|
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,465
|
s219549134
|
p00004
|
u492005863
|
1381234558
|
Python
|
Python
|
py
|
Accepted
| 10
|
4232
| 254
|
# Simultaneous Equation
import sys
datas = []
for line in sys.stdin:
datas.append(map(float, line.split()))
for data in datas:
a, b, c, d, e, f = data
y = (c * d - a * f) / (b * d - a * e)
x = (c - b * y) / a
print "{0:.3f} {1:.3f}".format(x, y)
|
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,466
|
s954304425
|
p00004
|
u511257811
|
1381675006
|
Python
|
Python
|
py
|
Accepted
| 10
|
4224
| 236
|
import sys
for line in sys.stdin:
a, b, c, d, e, f = map(int, line.rstrip('\n').split(' '))
x = int((e*c - b*f) * 1000 / (a*e - b*d)) / 1000.0
y = int((a*f - d*c) * 1000 / (a*e - b*d)) / 1000.0
print '%.3f %.3f' % (x, y)
|
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,467
|
s772911992
|
p00004
|
u351182591
|
1382019629
|
Python
|
Python
|
py
|
Accepted
| 10
|
4244
| 325
|
while 1:
try:
P = map(float,raw_input().split())
except EOFError:
break
x = (P[2]*P[4]-P[5]*P[1])/(P[0]*P[4]-P[3]*P[1])
y = (P[2]*P[3]-P[5]*P[0])/(P[1]*P[3]-P[4]*P[0])
x = x if x else 0
y = y if y else 0
print "{:.3f} {:.3f}".format(x,y)
|
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,468
|
s625917704
|
p00004
|
u674319057
|
1382286786
|
Python
|
Python
|
py
|
Accepted
| 10
|
4236
| 381
|
#!/usr/bin/env python
get_y = lambda a,b,c,d,e,f: (f-(c*d/a)) / (e-(b*d/a))
get_x = lambda a,b,c,y: (c-b*y)/a
if __name__ == "__main__":
while True:
try:
a,b,c,d,e,f = [float(z) for z in raw_input().split()]
y = get_y(a,b,c,d,e,f)
x = get_x(a,b,c,y)
print "%.3f %.3f" % (x, y)
except EOFError:
break
|
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,469
|
s525547073
|
p00004
|
u912237403
|
1388818887
|
Python
|
Python
|
py
|
Accepted
| 20
|
4232
| 215
|
import sys
for s in sys.stdin:
a,b,c,d,e,f=map(float,s.split())
x=c*e-b*f
y=a*f-c*d
z=a*e-b*d
def f(x,z):
if x==0: return 0
else: return x/z
print "%.3f %.3f" %(f(x,z),f(y,z))
|
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,470
|
s139495287
|
p00004
|
u912237403
|
1388819105
|
Python
|
Python
|
py
|
Accepted
| 10
|
4232
| 217
|
import sys
for s in sys.stdin:
a,b,c,d,e,f=map(int,s.split())
x=c*e-b*f
y=a*f-c*d
z=a*e-b*d
def f(x,z):
if x==0: return 0
else: return 1.0*x/z
print "%.3f %.3f" %(f(x,z),f(y,z))
|
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,471
|
s389288947
|
p00004
|
u912237403
|
1388819459
|
Python
|
Python
|
py
|
Accepted
| 10
|
4216
| 140
|
import sys
for s in sys.stdin:
a,b,c,d,e,f=map(int,s.split())
y=(a*f-c*d)*1.0/(a*e-b*d)
x=(c-b*y)/a
print "%.3f %.3f" %(x,y)
|
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,472
|
s650471276
|
p00004
|
u786185717
|
1389529209
|
Python
|
Python
|
py
|
Accepted
| 10
|
4240
| 258
|
z = []
while True:
try:
a, b, c, d, e, f = map(float, raw_input().split())
x = (c * e - b * f) / (a * e - d * b)
y = (c * d - f * a) / (b * d - e * a)
z.append([x, y])
except:
break
for i in z:
print("{:.3f} {:.3f}".format(i[0] + 0, i[1] + 0))
|
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,473
|
s693025860
|
p00004
|
u912237403
|
1390119188
|
Python
|
Python
|
py
|
Accepted
| 10
|
4216
| 123
|
import sys
for s in sys.stdin:
a,b,c,d,e,f=map(float,s.split())
y=(a*f-c*d)/(a*e-b*d)
print "%.3f %.3f"%((c-b*y)/a,y)
|
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,474
|
s973410723
|
p00004
|
u230836528
|
1392095456
|
Python
|
Python
|
py
|
Accepted
| 10
|
4236
| 315
|
# -*- coding: utf-8 -*-
import sys
outList = []
for line in sys.stdin.readlines():
List = map(float, line.strip().split())
[a, b, c, d, e, f] = List
x = (b*f-c*e)/(b*d-a*e)
y = (a*f-c*d)/(a*e-b*d)
outList.append("%.3f %.3f" % (x+0, y+0))
for i in xrange(len(outList)):
print outList[i]
|
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,475
|
s920864625
|
p00004
|
u633068244
|
1393350246
|
Python
|
Python
|
py
|
Accepted
| 10
|
4224
| 174
|
while True:
try:
a,b,c,d,e,f=map(float,raw_input().split())
y=(d*c-a*f)*1.0/(d*b-a*e)
print "%.3f %.3f" % ((c-b*y)/a, y)
except:
break
|
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,476
|
s925201493
|
p00004
|
u193025715
|
1394792198
|
Python
|
Python
|
py
|
Accepted
| 10
|
4240
| 340
|
while 1:
try:
a, b, c, d, e, f = map(float, raw_input().split())
x = (c * e - b * f) / (a * e - b * d)
y = (f * a - c * d) / (a * e - d * b)
if x == -0.000:
x = 0.000
if y == -0.000:
y = 0.000
print str('%.3f' % x) + " " + str('%.3f' % y)
except:
break
|
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,477
|
s498558737
|
p00004
|
u491763171
|
1396337843
|
Python
|
Python
|
py
|
Accepted
| 20
|
4256
| 597
|
while 1:
try:
a, b, c, d, e, f = map(float, raw_input().split())
matrix = [[a, b, c], [d, e, f]]
for i in range(2):
tmp = matrix[i][i]
for j in range(3):
matrix[i][j] = matrix[i][j] / tmp
for j in range(2):
if i == j:
continue
else:
a = matrix[j][i]
for k in range(i, 3):
matrix[j][k] = matrix[j][k] - a * matrix[i][k]
print "%.3f %.3f" % (matrix[0][2], matrix[1][2])
except:
break
|
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,478
|
s319318111
|
p00004
|
u491763171
|
1396338962
|
Python
|
Python
|
py
|
Accepted
| 10
|
4256
| 632
|
def gauss(matrix):
dimension = len(matrix)
for i in range(dimension):
tmp = matrix[i][i]
for j in range(dimension + 1):
matrix[i][j] /= tmp
for j in range(dimension):
if i == j:
continue
else:
tmp2 = matrix[j][i]
for k in range(i, dimension + 1):
matrix[j][k] -= tmp2 * matrix[i][k]
return zip(*matrix)[-1]
while 1:
try:
a, b, c, d, e, f = map(float, raw_input().split())
matrix = [[a, b, c], [d, e, f]]
print "%.3f %.3f" % gauss(matrix)
except:
break
|
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,479
|
s099525176
|
p00004
|
u881567576
|
1397762468
|
Python
|
Python
|
py
|
Accepted
| 20
|
4228
| 204
|
while 2>1:
try:
a,b,c,d,e,f = map(float, raw_input().split(" "))
x=(c*e-b*f)/(e*a-b*d)
y=(c*d-a*f)/(b*d-e*a)
print "%.3f %.3f" % (x+0,y+0)
except EOFError:
break
except ValueError:
break
|
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,480
|
s428505836
|
p00004
|
u708217907
|
1397879948
|
Python
|
Python
|
py
|
Accepted
| 20
|
4212
| 151
|
import sys
for s in sys.stdin:
a, b, c, d, e, f = map(float, s.split())
y = (a*f - d*c)/(a*e - d*b)
x = (c - b*y)/a
print '%.03f %.03f'%(x, y)
|
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,481
|
s221665741
|
p00004
|
u146816547
|
1398777269
|
Python
|
Python
|
py
|
Accepted
| 10
|
4236
| 224
|
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,482
|
s267049665
|
p00004
|
u436634575
|
1400911253
|
Python
|
Python3
|
py
|
Accepted
| 30
|
6744
| 264
|
while True:
try:
line = input()
except:
break
a,b,c,d,e,f = map(int, line.strip().split())
z = a * e - b * d
x = c * e - b * f
if x: x = x / z
y = a * f - c * d
if y: y = y / z
print('{:.3f} {:.3f}'.format(x, y))
|
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,483
|
s537265367
|
p00004
|
u557208833
|
1402198292
|
Python
|
Python
|
py
|
Accepted
| 10
|
4384
| 416
|
import sys
import math
def readdata():
for line in sys.stdin:
yield map(int,line.split())
def rounder(decimal):
rounded = round(decimal*1000)/1000
if rounded == -0.0:
rounded = +0.0
return rounded
for data in readdata():
[a,b,c,d,e,f] = map(float,data)
det = a*e-b*d
x = (c*e-b*f)/det
y = (a*f-c*d)/det
[x,y] = map(rounder,[x,y])
print "%1.3f %1.3f" % (x,y)
|
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,484
|
s487865562
|
p00004
|
u413645175
|
1597761747
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5592
| 317
|
while True:
try:
a,b,c,d,e,f = (float(x) for x in input().split())
x = (c * e - b * f) / (a * e - b * d)
y = (c * d - a * f) / (b * d - a * e)
if x == 0: x = 0
if y == 0: y = 0
print(format(x, ".3f"), format(y, ".3f"))
except EOFError:
break
|
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,485
|
s050451285
|
p00004
|
u350481745
|
1597744853
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5596
| 257
|
while True:
try:
a,b,c,d,e,f=map(float, input().split())
x=(c*e-b*f)/(a*e-b*d)
y=(c*d-a*f)/(b*d-a*e)
if x==-0:
x=0
if y==-0:
y=0
print(f"{x:.3f} {y:.3f}")
except:
break
|
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,486
|
s277430693
|
p00004
|
u371026526
|
1597735846
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5608
| 153
|
while True:
try:
a,b,c,d,e,f = map(int,input().split())
y = (c*d-a*f)/(b*d-a*e)
x = (c-b*y)/a
print('{:.3f} {:.3f}'.format(x,y))
except: break
|
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,487
|
s358187154
|
p00004
|
u991830357
|
1597707626
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5620
| 203
|
while True:
try:
a, b, c, d, e, f = map(int, input().split())
except EOFError:
break
print(format(round((c*e-b*f)/(a*e-b*d)+0.,3), ".3f"), format(round((a*f-c*d)/(a*e-b*d)+0.,3), ".3f"), sep=" ")
|
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,488
|
s218974148
|
p00004
|
u799752967
|
1597671344
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5580
| 301
|
# coding: utf-8
# Your code here!
b=0.0001
while True:
try:
a=list(map(float,input().split()))
x=(a[2]*a[4]-a[1]*a[5])/(a[0]*a[4]-a[1]*a[3])
y=(a[2]*a[3]-a[0]*a[5])/(a[1]*a[3]-a[0]*a[4])
print("{0:.3f} {1:.03f}".format(x+b,y+b))
except EOFError:
break
|
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,489
|
s774152966
|
p00004
|
u976648183
|
1597670228
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5620
| 238
|
while True:
try:
L=list(map(int,input().split()))
x=L[0]*L[4]-L[3]*L[1]
y=L[2]*L[4]-L[5]*L[1]
z=y/x+0
w=(L[2]-L[0]*z)/L[1]+0
print(f"{z:.3f} {w:.3f}")
except EOFError:
break
|
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,490
|
s207309778
|
p00004
|
u931484744
|
1597669235
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5592
| 440
|
# coding: utf-8
# Your code here!
while True:
try:
a, b, c, d, e, f = map(float, input().split())
x = (c * e - b * f) / (a * e - b * d)
y = (c - a * x) / b
if x == 0:
print('{:.3f}'.format(abs(x)), '{:.3f}'.format(y))
elif y == 0:
print('{:.3f}'.format(x), '{:.3f}'.format(abs(y)))
else:
print('{:.3f}'.format(x), '{:.3f}'.format(y))
except EOFError:
break
|
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,491
|
s622689025
|
p00004
|
u926092389
|
1597657534
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5628
| 272
|
while True:
try:
a,b,c,d,e,f=map(int,input().split())
y=(c*d-a*f)/(b*d-a*e)
x=(e*c-b*f)/(a*e-b*d)
if x==0:
x=0
if y==0:
y=0
print(f'{x:.3f} {y:.3f}')
except:
break
|
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,492
|
s643664918
|
p00004
|
u593595530
|
1597650673
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5612
| 208
|
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,493
|
s883770763
|
p00004
|
u838993229
|
1597647810
|
Python
|
Python3
|
py
|
Accepted
| 30
|
6408
| 484
|
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
while True:
try:
a,b,c,d,e,f = map(float, input().split())
x = (c*e - b*f) / (a*e - b*d)
y = (a*f - c*d) / (a*e - b*d)
if x == -0:
x = int(x)
if y == -0:
y = int(y)
X = Decimal(x).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP)
Y = Decimal(y).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP)
print(f'{X:.3f} {Y:.3f}')
except EOFError:
break
|
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,494
|
s611386787
|
p00004
|
u862272701
|
1597576684
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5620
| 195
|
while True:
try:
a,b,c,d,e,f = map(int, input().split())
X = d/a
y = (c*X-f)/(b*X-e)
x = (c-b*y)/a
print(f'{x:.3f} {y:.3f}')
except:
break
|
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,495
|
s283863171
|
p00004
|
u397004753
|
1597542791
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5628
| 249
|
while True:
try:
a,b,c,d,e,f= map(int,input().split())
except EOFError:
break
x = (e*c-f*b)/(e*a-b*d)
y = (d*c-f*a)/(d*b-a*e)
if -0.0005 < x <= 0:
x = 0.000
if -0.0005 < y <= 0:
y = 0.000
print(f'{x:.3f}',f'{y:.3f}')
|
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,496
|
s715414713
|
p00004
|
u140569607
|
1597503825
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5628
| 303
|
while True:
try:
a,b,c,d,e,f = map(int,input().split())
x = (c * e - b * f) / (a * e - b * d)
y = (c * d - a * f) / (b * d - a * e)
if x == 0:
x = 0
if y == 0:
y = 0
print(f"{x:.3f} {y:.3f}")
except:
break
|
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,497
|
s138141594
|
p00004
|
u512192552
|
1597424918
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5632
| 270
|
# coding: utf-8
# Your code here!
def ren(a,b,c,d,e,f):
x=(c*e-f*b)/(a*e-b*d)
y=(c*d-f*a)/(b*d-e*a)
print(f'{x+0:.3f} {y+0:.3f}')
while True:
try:
a,b,c,d,e,f=map(int,input().split())
except EOFError:
break
ren(a,b,c,d,e,f)
|
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,498
|
s717047307
|
p00004
|
u919773430
|
1597404521
|
Python
|
Python3
|
py
|
Accepted
| 30
|
6404
| 481
|
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
while True:
try:
a,b,c,d,e,f = map(float, input().split())
x = (c*e - b*f) / (a*e - b*d)
y = (a*f - c*d) / (a*e - b*d)
if x==-0:
x=int(x)
if int(y)==-0:
y=int(y)
X = Decimal(x).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP)
Y = Decimal(y).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP)
print(f'{X:.3f} {Y:.3f}')
except EOFError:
break
|
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,499
|
s473317775
|
p00004
|
u695386605
|
1597207054
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5624
| 284
|
while True:
try:
a, b, c, d, e, f = map(int,input().split())
x = (b*f - e*c) / (b*d - a*e)
y = (a*f - c*d) / (a*e - b*d)
if x == -0.000:
x = 0
print('{:.3f}'.format(x), '{:.3f}'.format(y))
except:
break
|
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,500
|
s984646495
|
p00004
|
u695568874
|
1597073736
|
Python
|
Python3
|
py
|
Accepted
| 40
|
6424
| 474
|
from decimal import Decimal,ROUND_HALF_UP,ROUND_HALF_EVEN
while True:
try:
a,b,c,d,e,f=map(int,input().split())
x=(c*e-b*f)/(a*e-b*d)
y=(a*f-c*d)/(a*e-b*d)
if x==-0:
x=int(x)
if y==-0:
y=int(y)
X=Decimal(x).quantize(Decimal('0.001'),rounding=ROUND_HALF_UP)
Y=Decimal(y).quantize(Decimal('0.001'),rounding=ROUND_HALF_UP)
print(f'{X:3f}',f'{Y:3f}')
except EOFError:
break
|
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,501
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.