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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s814827334
|
p00004
|
u053015104
|
1596882684
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5616
| 170
|
while 1:
try:
a,b,c,d,e,f=map(int,input().split())
x=(c*d-a*f)/(b*d-a*e)
print("{:.3f} {:.3f}".format((c-b*x)/a,x))
except:
break
|
p00004
|
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
|
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
|
-1.000 2.000
1.000 4.000
| 3,502
|
s549773518
|
p00004
|
u711365732
|
1596762097
|
Python
|
Python3
|
py
|
Accepted
| 40
|
6400
| 476
|
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,503
|
s610140929
|
p00004
|
u240091169
|
1596692153
|
Python
|
Python3
|
py
|
Accepted
| 30
|
6400
| 476
|
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,504
|
s945759227
|
p00004
|
u413704014
|
1596690528
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5584
| 362
|
while True:
try:
a,b,c,d,e,f = (float(x) for x in input().split())
x = (c * e - b * f) / (a * e - b * d)
y = (c * d - a * f) / (b * d - a * e)
except:
break
x = round(x, 3)
y = round(y, 3)
if x == -0.000:
x = 0.000
elif y == -0.000:
y = 0.000
print("{0:.3f} {1:.3f}" . format(x, y))
|
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,505
|
s914485036
|
p00004
|
u192469946
|
1596636860
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5584
| 305
|
#0004
while True:
try:
a,b,c,d,e,f = map(float,input().split())
y = (a*f-d*c)/(a*e-b*d)
x = (f*b-e*c)/(b*d-a*e)
if x == -0.0:
x = 0.000
elif y == -0.0:
y = 0.000
print(format(x, '.3f'),format(y, '.3f'))
except:
break
|
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,506
|
s928462591
|
p00004
|
u705625724
|
1596630495
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5604
| 295
|
# coding: utf-8
# 83
while True:
try:
a,b,c,d,e,f = map(float,input().split())
X = (f*b-e*c)/(b*d-e*a)
Y = (a*f-d*c)/(a*e-b*d)
if X==-0.0:
X=0.0
elif Y==-0.0:
Y=0.0
print(f"{X:.3f} {Y:.3f}")
except:
break
|
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,507
|
s562394061
|
p00004
|
u392970366
|
1596619576
|
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,508
|
s356639537
|
p00004
|
u309196579
|
1596610775
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5608
| 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,509
|
s414970991
|
p00004
|
u874049078
|
1596570279
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5596
| 305
|
#83 連立方程式
while True:
try:
a, b, c, d, e, f = map(float,input().split())
except:
break
x = (e*c - b*f) / (a*e - b*d)
y = (c*d - a*f) / (b*d - a*e)
if x == -0.0 :
x = 0.0
if y == -0.0 :
y == 0.0
print(f'{x:.3f}', f'{y:.3f}')
|
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,510
|
s219225327
|
p00004
|
u795882061
|
1596548557
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5612
| 202
|
while True:
try:
a,b,c,d,e,f = map(int,input().split())
y = (c*d-f*a)/(b*d-e*a)
x = (c-(b*y))/a
print('{:.3f} {:.3f}'.format(x,y))
except EOFError:
break
|
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,511
|
s070321105
|
p00004
|
u251716708
|
1596547982
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5580
| 349
|
while 1: #ax+by=c #dx+ey=f
try:
a,b,c,d,e,f=map(float,input().split())
det=a*e-d*b
x=(e*c-b*f)/det
y=(-d*c+a*f)/det
if abs(x) < 0.0001:
x = 0.0
if abs(y) < 0.0001:
y = 0.0
print(format(x,'.3f'),format(y,'.3f'))
except EOFError:
break
|
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,512
|
s656063466
|
p00004
|
u635020217
|
1596470657
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5620
| 307
|
# coding: utf-8
# Your code here!
c = 0.0001
while True:
try:
a = list(map(int,input().split()))
b1 = a[0]*a[4]-a[3]*a[1]
b2 = a[2]*a[4]-a[5]*a[1]
b3 = a[0]*a[5]-a[3]*a[2]
print("{0:.3f} {1:.3f}" .format(b2/b1 + c, b3/b1 + c))
except EOFError:
break
|
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,513
|
s054123254
|
p00004
|
u554271288
|
1596465896
|
Python
|
Python3
|
py
|
Accepted
| 30
|
6364
| 438
|
from decimal import *
while True:
try:
a,b,c,d,e,f=map(float, input().split())
except:
break
m=(c*e-b*f)
n=(a*e-b*d)
if m == 0.0:
x=0.0
else:
x=m/n
m=(c*d-a*f)
n=(b*d-a*e)
if m == 0.0:
y=0.0
else:
y=m/n
print(Decimal(str(x)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP),Decimal(str(y)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP))
|
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,514
|
s134276230
|
p00004
|
u677563181
|
1596460939
|
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,515
|
s041029897
|
p00004
|
u826807985
|
1596436366
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5600
| 579
|
try:
while True:
a,b,c,d,e,f = map(float,input().split())
if a - d == 0:
y = (c - f) / (b - e)
x = (c - b*y) / a
else:
A = a*d
D = d*a
B = b*d
C = c*d
E = e*a
F = f*a
if C < F :
y = (C - F) / (B - E)
x = (c - b*y) / a
else:
y = (F - C) / (E - B)
x = (c - b*y) / a
print(f'{round(x,3):.03f}',f'{round(y,3):.03f}')
except EOFError:
pass
|
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,516
|
s948626097
|
p00004
|
u814278309
|
1596347040
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5596
| 183
|
while 1:
try:
a,b,c,d,e,f=map(float,input().split())
y = (c*d-a*f)/(b*d-a*e)
x = (c-b*y)/a
print(f'{x:.3f} {y:.3f}')
except:
break
|
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,517
|
s722724143
|
p00004
|
u272062354
|
1596090994
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5600
| 227
|
try:
while True:
a,b,c,d,e,f=map(float,input().split())
x=(c*e-f*b)/(a*e-d*b)
y=(c*d-f*a)/(b*d-e*a)
if x==0:
x=0.000
print(f'{x:5.3f} {y:5.3f}')
except EOFError:
pass
|
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,518
|
s990641348
|
p00004
|
u173393391
|
1596000468
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5616
| 284
|
while True:
try:
a,b,c,d,e,f=map(int,input().split())
m=b*d-e*a
x=-(c*e-f*b)/m
y=(c*d-f*a)/m
if x==0:
x=abs(x)
if y==0:
y=abs(y)
print("{:.3f} {:.3f}" .format(x,y))
except:
break
|
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,519
|
s965171721
|
p00004
|
u770042163
|
1595927654
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5616
| 269
|
while True:
try:
a,b,c,d,e,f = map(int,input().split())
except:
break
A = a*e - b*d
x = (e*c - b*f)/A
y = (a*f - d*c)/A
# 出力の体裁を整え、-0.00を0.00にするため+0する
print("{:.3f} {:.3f}".format(x+0,y+0))
|
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,520
|
s200725145
|
p00004
|
u221550784
|
1595898240
|
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,521
|
s472554432
|
p00004
|
u988962397
|
1595828299
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5620
| 219
|
while True:
try:
a,b,c,d,e,f=map(int, input().split())
y=(a*f-d*c)/(a*e-d*b)
x=(-b*y+c)/a
print("{:.3f} {:.3f}".format(x,y))
except EOFError:
break
|
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,522
|
s463917214
|
p00004
|
u586171604
|
1595827565
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5620
| 161
|
while 1:
try:
a,b,c,d,e,f=map(int,input().split())
x=(c*d-a*f)/(b*d-a*e)
print("{:.3f} {:.3f}".format((c-b*x)/a,x))
except:break
|
p00004
|
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
|
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
|
-1.000 2.000
1.000 4.000
| 3,523
|
s794378652
|
p00004
|
u470391435
|
1595827450
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5604
| 228
|
def ren(a,b,c,d,e,f):
x = (c*e-f*b)/(a*e-b*d)
y = (c*d-f*a)/(b*d-e*a)
print(f'{x+0:.3f} {y+0:.3f}')
while True:
try:
a,b,c,d,e,f=map(float,input().split())
except:
break
ren(a,b,c,d,e,f)
|
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,524
|
s715601263
|
p00004
|
u633358233
|
1595818884
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5624
| 295
|
while True :
try :
a, b, c, d, e, f = map(int, input().split())
except EOFError :
break
x = (e*c - b*f) / (a*e - b*d)
y = (c*d - a*f) / (b*d - a*e)
if x == -0.0 :
x = 0.0
if y == -0.0 :
y == 0.0
print(f'{x:.3f}', f'{y:.3f}')
|
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,525
|
s605857663
|
p00004
|
u555228137
|
1595716862
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5628
| 253
|
while True:
try:
a,b,c,d,e,f=map(int,input().split())
x=(c*e-b*f)/(a*e-b*d)
y=(c-a*x)/b
if x==-0:
x=0
if y==-0:
y=0
print(f'{x:.3f} {y:.3f}')
except EOFError:
break
|
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,526
|
s961518311
|
p00004
|
u895962529
|
1595342574
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5600
| 205
|
while True:
try:
a,b,c,d,e,f=map(float,input().split())
x=(c*e-b*f)/(a*e-b*d)
y=(c*d-a*f)/(b*d-a*e)
if x==-0: x=0
if y==-0: x=0
print(f'{x:.3f} {y:.3f}')
except EOFError: break
|
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,527
|
s982415922
|
p00004
|
u511292942
|
1595220167
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5620
| 306
|
while True:
try:
a,b,c,d,e,f = [int(x) for x in input().split()]
x = (c*e - b*f)/(a*e - b*d)
y = (c*d - a*f)/(b*d - a*e)
if(x == 0):
x = 0
if(y == 0):
y = 0
print("{0:.3f} {1:.3f}".format(x,y))
except:
break
|
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,528
|
s660774404
|
p00004
|
u753534330
|
1594743642
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5588
| 284
|
while 1:
try:
a, b, c, d, e, f = map(float, input().split())
except:
break
x = (c*e - b*f) / (a*e - b*d)
y = (c*d - a*f) / (b*d - a*e)
if x == 0: x = 0
if y == 0: y = 0
print('{:.3f}'.format(x), '{:.3f}'.format(y))
|
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,529
|
s667769215
|
p00004
|
u350963229
|
1594339511
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5612
| 193
|
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,530
|
s960108068
|
p00004
|
u271406356
|
1594206933
|
Python
|
Python3
|
py
|
Accepted
| 30
|
6360
| 399
|
from decimal import Decimal, ROUND_HALF_UP
while True:
try:
a, b, c, d, e, f = map(float, input().split())
x = (c * e - b * f) / (a * e - b * d) + 0.0
y = (c * d - a * f) / (b * d - a * e) + 0.0
print(Decimal(str(x)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP), Decimal(str(y)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP))
except:
break
|
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,531
|
s942530619
|
p00004
|
u057249340
|
1593260577
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5612
| 220
|
try:
while True:
a,b,c,d,e,f=map(int, input().split())
y = (a*f - c*d) / (a*e - b*d)
x = (c - b*y) / a
print('{:.03f}'.format(x), '{:.03f}'.format(y))
except:
pass
|
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,532
|
s875181443
|
p00004
|
u747915832
|
1592818746
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5604
| 442
|
while True:
try:
a, b, c, d, e, f = map(float, input().split())
except:
break
if b==0:
x = c/a
y = (f-d*x)/e
elif e==0:
x = f/d
y = (c-a*x)/b
else:
x = (b*f-c*e)/(b*d-a*e)
y = c/b - a*x/b
if x==0:
print(f'{abs(x):.3f} {y:.3f}')
elif y==0:
print(f'{x:.3f} {abs(y):.3f}')
else:
print(f'{x:.3f} {y:.3f}')
|
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,533
|
s151652378
|
p00004
|
u647921435
|
1592525526
|
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,534
|
s847456676
|
p00004
|
u128671689
|
1592406853
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5592
| 178
|
while True:
try:
a,b,c,d,e,f=map(float,input().split())
y=(c*d-a*f)/(b*d-a*e)
x=(c-b*y)/a
print(f'{x:.3f} {y:.3f}')
except:
break
|
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,535
|
s263341446
|
p00004
|
u228556128
|
1592314932
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5584
| 251
|
while True:
try:
a,b,c,d,e,f=map(float,input().split())
except:
break
x=(b*f-c*e)/(b*d-a*e)
(c*d-a*f)/(b*d-a*e)
y=(c-a*x)/b
if x==-0:
x=0
if y==-0:
y=0
print("{:.3f} {:.3f}".format(x,y))
|
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,536
|
s914697039
|
p00004
|
u583329397
|
1592199341
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5604
| 269
|
while True:
try:
a,b,c,d,e,f=map(int,input().split())
det=a*e-b*d
x=(e*c-b*f)
y=(a*f-d*c)
if det<0:
x=-x
y=-y
det=-det
print("%.03f %.03f" %(x/det,y/det))
except:
break
|
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,537
|
s014514822
|
p00004
|
u395654950
|
1592197568
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5592
| 441
|
# 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,538
|
s092518010
|
p00004
|
u187074069
|
1592187935
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5616
| 331
|
while True:
try:
lst = list(map(int, input().split()))
a, b, c, d, e, f = lst[0], lst[1], lst[2], lst[3], lst[4], lst[5]
x = (b*f - c*e)/(b*d - a*e)
y = (c*d - a*f)/(b*d - a*e)
print('{:.3f}'.format(x+0.0), end = " ")
print('{:.3f}'.format(y+0.0))
except:
break
|
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,539
|
s170759734
|
p00004
|
u994684803
|
1591596344
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5612
| 179
|
while True:
try:
a,b,c,d,e,f = map(int,input().split())
except:
break
y=(c*d-a*f)/(b*d-a*e)
print("{0:.3f} {1:.3f}".format((c-b*y)/a,y))
|
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,540
|
s738391256
|
p00004
|
u245861861
|
1591097107
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5616
| 266
|
listal=[]
while True:
try:
listal.append(input())
except:
break
for i in listal:
j=list(map(int,i.split()))
y=(j[3]*j[2]-j[0]*j[5])/(j[1]*j[3]-j[0]*j[4])
x=(j[2]-j[1]*y)/j[0]
print('{:.3f}'.format(x),'{:.3f}'.format(y))
|
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,541
|
s862801633
|
p00004
|
u662362547
|
1591060040
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5616
| 175
|
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,542
|
s298536321
|
p00004
|
u037441960
|
1589021175
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5596
| 350
|
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,543
|
s891771307
|
p00004
|
u014861569
|
1588963344
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5624
| 202
|
for i in range(1,100000000):
try:
a,b,c,d,e,f=map(int,input().split())
y=(a*f-d*c)/(e*a-b*d)
x=(c-b*y)/a
print(f'{x:.3f} {y:.3f}')
except EOFError:
break
|
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,544
|
s262002732
|
p00004
|
u260980560
|
1588728135
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5612
| 233
|
for line in open(0).readlines():
a, b, c, d, e, f = map(int, line.split())
det = a*e - b*d
x = (e*c - b*f)
y = (a*f - d*c)
if det < 0:
x = -x; y = -y; det = -det
print("%.03f %.03f" % (x/det, y/det))
|
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,545
|
s114716347
|
p00004
|
u230927103
|
1586358162
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5584
| 371
|
import sys
for line in sys.stdin.readlines():
a, b, c, d, e, f = map(float, line.split())
x = (c * e - b * f)/(a * e - b * d)
y = (c * d - a * f)/(b * d - a * e)
if ((c * e - b * f == 0) | (a * e - b * d == 0)):
x = 0
if ((c * d - a * f == 0) | (b * d - a * e == 0)):
y = 0
print('{:.3f}'.format(x), '{:.3f}'.format(y))
|
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,546
|
s507257531
|
p00004
|
u701163915
|
1582536431
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5592
| 371
|
while 1:
try:
s=list(map(float,input().split()))
up=s[4]/s[1]
a=s[0]*up
b=s[1]*up
c=s[2]*up
d=s[3]
e=s[4]
f=s[5]
ad=a-d
cf=c-f
x=round(cf/ad,3)
if x==-0.000:
x=0.00
y=round((s[2] - s[0]*x)/s[1],3)
if y==-0.000:
y=0.000
print('{:.3f}'.format(x),'{:.3f}'.format(y))
except EOFError:
break
|
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,547
|
s389640393
|
p00004
|
u630911389
|
1582248332
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5588
| 315
|
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,548
|
s329197508
|
p00004
|
u153447291
|
1580731723
|
Python
|
Python3
|
py
|
Accepted
| 30
|
6396
| 558
|
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
while True:
try:
z = list(map(int,input().split()))
except:
break
a = z[:3]
b = z[3:]
c = a[:]
d = b[:]
s = [a[0],b[0]]
a = list(map(lambda x:x*s[1],a))
b = list(map(lambda x:x*s[0],b))
y = (b[2]-a[2])/(b[1]-a[1])
try:
x = (c[2]-c[1]*y)/c[0]
except:
x = (d[2]-d[1]*y)/d[0]
print(Decimal(str(x)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP),Decimal(str(y)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP))
|
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,549
|
s863891241
|
p00004
|
u813197825
|
1576428616
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5632
| 342
|
import sys
lines = sys.stdin.readlines()
for line in lines:
s = str(line)
a,b,c,d,e,f = map(int, s.rstrip('\n').split())
x = (e*c - b*f) / (a*e - b*d)
if e*c - b*f == 0:
x = 0
x = round(x, 3)
y = (a*f - c*d) / (a*e - b*d)
if a*f - c*d == 0:
y = 0
y = round(y, 3)
print(f'{x:.3f} {y:.3f}')
|
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,550
|
s551564218
|
p00004
|
u617401892
|
1576249179
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5680
| 403
|
import sys, math
array = []
for line in sys.stdin:
array.append(map(int, line.split(' ')))
for a, b, c, d, e, f in array:
determinant = a * e - b * d
if determinant == 0:
print('NO ANSWER')
x = (c * e - b * f) / determinant
y = (a * f - c * d) / determinant
x = math.floor(x * 1000) / 1000
y = math.floor(y * 1000) / 1000
print('{0:.3f} {1:.3f}'.format(x, y))
|
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,551
|
s544080671
|
p00004
|
u297517978
|
1573379974
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5612
| 174
|
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,552
|
s346954932
|
p00004
|
u933957884
|
1572665968
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5628
| 218
|
import sys;print("\n".join(["{:.3f}".format(int((e*c-b*f)/(a*e-b*d)*1000)/1000) + " " + "{:.3f}".format(int((-d*c+a*f)/(a*e-b*d)*1000)/1000) for x in sys.stdin for a, b, c, d, e, f in [[int(y) for y in x.split()]] ]))
|
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,553
|
s616474254
|
p00004
|
u447421429
|
1571889590
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5616
| 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,554
|
s976167940
|
p00004
|
u629170852
|
1567958282
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5620
| 284
|
k=[]
try:
while True:
k.append(list(map(int,input().split())))
except EOFError:
pass
for a,b,c,d,e,f in k:
if f*b-c*e==0:
x=0
else:
x=(f*b-c*e)/(b*d-a*e)
if f*a-c*d==0:
y=0
else:
y=(f*a-c*d)/(a*e-b*d)
print("%.3f %.3f" % (x,y))
|
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,555
|
s421577194
|
p00004
|
u445425884
|
1564925206
|
Python
|
Python3
|
py
|
Accepted
| 50
|
9064
| 2,637
|
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
class Matrix():
def __init__(self, A):
self.A = A
self.row = len(A)
self.col = len(A[0])
def __iter__(self):
return self.A.__iter__()
def __getitem__(self, i):
return self.A.__getitem__(i)
def __add__(self, B):
aa = self.A
bb = B.A
return Matrix([[aa[i][j] + bb[i][j] for j in range(self.col)] for i in range(self.row)])
def __sub__(self, B):
aa = self.A
bb = B.A
return Matrix([[aa[i][j] - bb[i][j] for j in range(self.col)] for i in range(self.row)])
def __mul__(self, B):
aa = self.A
bb = B.A
a = []
for i in range(self.row):
ai = aa[i]
r = []
for j in range(B.col):
r.append(sum([ai[k] * bb[k][j] for k in range(self.col)]))
a.append(r)
return Matrix(a)
def __truediv__(self, x):
pass
def lu(self):
size = self.row
T = copy.deepcopy(self.A)
L = [[0]*size for _ in range(size)]
U = [[0]*size for _ in range(size)]
for i in range(size):
for j in range(i,size):
L[j][i] = T[j][i]
for j in range(i,size):
U[i][j] = T[i][j] / T[i][i]
for j in range(i+1,size):
for k in range(i+1,size):
T[j][k] -= L[j][i] * U[i][k]
return Matrix(L),Matrix(U)
def __str__(self):
return self.A.__str__()
def solve_se(A, b):
n = A.row
L,U = A.lu()
y = []
for i in range(n):
t = b[i]
for k in range(i):
t -= L[i][k] * y[k]
y.append(t / L[i][i])
x = [0] * n
for i in range(n-1,-1,-1):
t = y[i]
for k in range(i+1,n):
t -= U[i][k] * x[k]
x[i] = t
return x
def main():
sa = [s for s in sys.stdin.read().split('\n') if s]
r = []
for s in sa:
a,b,c,d,e,f = [int(c) for c in s.split()]
A = Matrix([[a,b],[d,e]])
B = [c,f]
x = solve_se(A,B)
r.append(' '.join(map(lambda t: '{:01.3f}'.format(1.0*t), x)))
return '\n'.join(r)
print(main())
|
p00004
|
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
|
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
|
-1.000 2.000
1.000 4.000
| 3,556
|
s348601055
|
p00004
|
u821561321
|
1564922021
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5580
| 148
|
import sys
for line in sys.stdin:
a,b,c,d,e,f=map(float,line.strip().split())
y=(c*d-a*f)/(b*d-a*e)
x=(c-b*y)/a
print("%.3lf %.3lf" %(x,y))
|
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,557
|
s561015510
|
p00004
|
u218784088
|
1564919359
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5576
| 184
|
while True:
try:
a,b,c,d,e,f = map(float, input().split())
y = (a*f-c*d)/(a*e-b*d)
x = (c-b*y)/a
print("%.3f %.3f"%(x,y))
except:
break
|
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,558
|
s405541429
|
p00004
|
u586792237
|
1564918446
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5576
| 184
|
while True:
try:
a,b,c,d,e,f = map(float, input().split())
y = (a*f-c*d)/(a*e-b*d)
x = (c-b*y)/a
print("%.3f %.3f"%(x,y))
except:
break
|
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,559
|
s021685069
|
p00004
|
u455877373
|
1564908720
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5580
| 360
|
import sys
while True:
line = sys.stdin.readline()
if line is '':
break
(a, b, e, c, d, f) = map(float, line.split())
D = a * d - b * c
x = (d * e - b * f) / D
y = (a * f - c * e) / D
if abs(x) < 1e-4:
x = 0.0
if abs(y) < 1e-4:
y = 0.0
print("{0:.3f} {1:.3f}".format(x, y))
|
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,560
|
s586066269
|
p00004
|
u525395303
|
1564626454
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5584
| 336
|
# 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,561
|
s529185779
|
p00004
|
u212392281
|
1564580687
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5624
| 442
|
try:
while(True):
a, b, c, d, e, f = map(int, input().split())
A = [[e/(a*e-b*d), (-1)*b/(a*e-b*d)],[(-1)*d/(a*e-b*d), a/(a*e-b*d)]]
Y = [c, f]
X = [(A[0][0]*Y[0] + A[0][1]*Y[1]), (A[1][0]*Y[0] + A[1][1]*Y[1])]
for i in range(2):
print('{:.3f}'.format(X[i]), end="")
if i == 1:
print("")
else:
print(" ", end="")
except:
pass
|
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,562
|
s925138021
|
p00004
|
u529337794
|
1564578288
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5616
| 161
|
while 1:
try:
a,b,c,d,e,f=map(int,input().split())
x=(c*d-a*f)/(b*d-a*e)
print("{:.3f} {:.3f}".format((c-b*x)/a,x))
except:break
|
p00004
|
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
|
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
|
-1.000 2.000
1.000 4.000
| 3,563
|
s868055721
|
p00004
|
u647694976
|
1564452299
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5592
| 275
|
import sys
for line in sys.stdin:
a, b, c, d, e, f = [float(x) for x in line.split()]
x = (f * b - e * c) / (d * b - a * e)
y = (c - a * x) / b
if abs(x) < 0.00001:
x = 0.000
if abs(y) < 0.00001:
y = 0.000
print("%.3f %.3f" % (x, y) )
|
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,564
|
s777698021
|
p00004
|
u678843586
|
1563938862
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5616
| 161
|
while 1:
try:
a,b,c,d,e,f=map(int,input().split())
x=(c*d-a*f)/(b*d-a*e)
print("{:.3f} {:.3f}".format((c-b*x)/a,x))
except:break
|
p00004
|
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
|
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
|
-1.000 2.000
1.000 4.000
| 3,565
|
s039828008
|
p00004
|
u397862444
|
1563166064
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5580
| 235
|
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,566
|
s095252935
|
p00004
|
u051789695
|
1562042114
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5620
| 304
|
while True:
try:
a,b,c,d,e,f=map(int,input().split())
except:
break
ba=(a*e)-(d*b)
x1=(c*e)-(f*b)
y1=(a*f)-(d*c)
x=round(x1/ba,4)
if x==0:
x=0.000
y=round(y1/ba,4)
if y==0:
y=0.000
print("{:.3f}".format(x),"{:.3f}".format(y))
|
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,567
|
s428079921
|
p00004
|
u013648252
|
1561961130
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5580
| 276
|
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,568
|
s084218922
|
p00004
|
u997476941
|
1561960075
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5616
| 161
|
while 1:
try:
a,b,c,d,e,f=map(int,input().split())
x=(c*d-a*f)/(b*d-a*e)
print("{:.3f} {:.3f}".format((c-b*x)/a,x))
except:break
|
p00004
|
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
|
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
|
-1.000 2.000
1.000 4.000
| 3,569
|
s573240619
|
p00004
|
u998437062
|
1561302756
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5580
| 256
|
#!/usr/bin/env python3
import sys
EPS = 1e-10
for line in sys.stdin:
a, b, c, d, e, f = map(float, line.split())
x = (e * c - b * f) / (a * e - b * d)
y = (a * f - c * d) / (a * e - b * d)
print('{:.3f} {:.3f}'.format(x + EPS, y + EPS))
|
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,570
|
s516855918
|
p00004
|
u264450287
|
1560748139
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5600
| 425
|
while True:
try:
a,b,c,d,e,f=map(float,input().split())
if (a*e-b*d)!=0:
x=(c*e-f*b)/(a*e-b*d)
if b!=0:
y=(c-a*x)/b
elif e!=0:
y=(f-d*x)/e
elif (b*d-e*a)!=0:
y=(c*d-f*a)/(b*d-e*a)
if a!=0:
x=(c-b*y)/a
elif d!=0:
x=(f-e*y)/d
if x==-0:
x=x+0.0
if y==-0:
y=y+0.0
print(f"{x:.3f}",f"{y:.3f}")
except EOFError:
break
|
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,571
|
s297165423
|
p00004
|
u614095715
|
1560508882
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5608
| 434
|
import sys
for line in sys.stdin.readlines():
a, b, c, d, e, f = [float(x) for x in line.split()]
if a!=0 and d!=0:
a, b, c = [x/a for x in [a, b, c]]
d, e, f = [x/d for x in [d, e, f]]
y = (c-f) / (b-e)
x = c - b * y
else:
a, b, c = [x/b for x in [a, b, c]]
d, e, f = [x/e for x in [d, e, f]]
x = (c-f) / (a-d)
y = c - a * x
print(f'{x:.3f} {y:.3f}')
|
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,572
|
s983058324
|
p00004
|
u567306474
|
1557595390
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5620
| 282
|
while True:
try:
a,b,c,d,e,f = [int(x) for x in input().split()]
x = (c*e - b*f)/(a*e - b*d)
y = (c*d - a*f)/(b*d - a*e)
if(x == 0): x = 0
if(y == 0): y = 0
print("{0:.3f} {1:.3f}".format(x,y))
except:
break
|
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,573
|
s755438420
|
p00004
|
u904226154
|
1557213596
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5588
| 257
|
while True:
try:
a, b, c, d, e, f = map(float, input().split())
x = (e * c - f * b) / (e * a - d * b) + 0
y = (d * c - f * a) / (d * b - e * a) + 0
print('{0:.3f} {1:.3f}'.format(x, y))
except EOFError:
break
|
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,574
|
s800034088
|
p00004
|
u054800243
|
1554715306
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5592
| 193
|
# coding: utf-8
import sys
for line in sys.stdin:
a, b, c, d, e, f = map(float, line.strip().split())
y = (c*d-a*f)/(b*d-a*e)
x = (c - b*y) / a
print("%.3lf %.3lf" % (x, y))
|
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,575
|
s553352882
|
p00004
|
u761923615
|
1554427422
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5580
| 237
|
while True:
try:
a,b,c,d,e,f=list(map(float,input().split()))
x=float((b*f-c*e)/(b*d-a*e))
y=float((c*d-a*f)/(b*d-a*e))
if x==-0.000:
x=0.000
if y==-0.000:
y=0.000
print("{0:.3f} {1:.3f}".format(x,y))
except:
break
|
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,576
|
s894138510
|
p00004
|
u763386533
|
1553798077
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5628
| 252
|
import sys
l=[[int(i) for i in l.split()] for l in sys.stdin]
for i in l:
a,b,c,d,e,f=i
x=round((c*e-b*f)/(a*e-b*d),3)
y=round((c*d-a*f)/(b*d-a*e),3)
if x==0:
x=0
if y==0:
y=0
print("{:.3f} {:.3f}".format(x,y))
|
p00004
|
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
|
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
|
-1.000 2.000
1.000 4.000
| 3,577
|
s820444571
|
p00004
|
u990228206
|
1553158678
|
Python
|
Python3
|
py
|
Accepted
| 30
|
6364
| 342
|
from decimal import Decimal, ROUND_HALF_UP
while 1:
try:
a,b,c,d,e,f=map(float,input().split())
x=(c*e-b*f)/(a*e-b*d)+0.0
y=(c*d-a*f)/(b*d-a*e)+0.0
print(Decimal(str(x)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP),Decimal(str(y)).quantize(Decimal('0.001'), rounding=ROUND_HALF_UP))
except:break
|
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,578
|
s177142747
|
p00004
|
u625806423
|
1551713784
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5584
| 176
|
while True:
try:
a, b, c, d, e, f = map(float, input().split())
except EOFError:
break
print("{0:.3f} {1:.3f}".format((c*e-b*f)/(a*e-b*d)+0,(c*d-a*f)/(b*d-a*e)))
|
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,579
|
s974345747
|
p00004
|
u195186080
|
1550661447
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5576
| 276
|
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,580
|
s943211463
|
p00004
|
u733798831
|
1550492398
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5616
| 264
|
try:
while True:
a,b,c,d,e,f=[int(i) for i in input().split(" ")]
x=(e*c-b*f)/(a*e-b*d)
y=(a*f-c*d)/(a*e-b*d)
if x==0:
x=0
if y==0:
y=0
print("%.3f %.3f"%(x,y))
except EOFError:
pass
|
p00004
|
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
|
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
|
-1.000 2.000
1.000 4.000
| 3,581
|
s720369504
|
p00004
|
u689047545
|
1547904418
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5580
| 426
|
if __name__ == '__main__':
while True:
try:
a, b, c, d, e, f = map(float, input().split())
x = (c*e - f*b)/(a*e - b*d)
y = (c*d - f*a)/(b*d - e*a)
if x == -0.0:
x = 0.0
if y == -0.0:
y = 0.0
print("{0:.3f}".format(x),end = ' ')
print("{0:.3f}".format(y))
except EOFError:
break
|
p00004
|
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
|
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
|
-1.000 2.000
1.000 4.000
| 3,582
|
s219234759
|
p00004
|
u291570764
|
1544770493
|
Python
|
Python3
|
py
|
Accepted
| 20
|
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,583
|
s868277774
|
p00004
|
u080014366
|
1543385513
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5584
| 277
|
while True:
try:
n=list(map(float, input().split()))#ファイルの読み込み --.py <--.txt
except EOFError:
break
y=(n[3]*n[2]-n[0]*n[5])/(n[1]*n[3]-n[0]*n[4])
x=(n[2]-n[1]*y)/n[0]
print('{:.3f}'.format(x), '{:.3f}'.format(y))#format関数を用いて桁を指定
|
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,584
|
s430909688
|
p00004
|
u573115711
|
1543220573
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5592
| 195
|
import sys
for line in sys.stdin:
a,b,c,d,e,f = [float(i) for i in line.strip().split()]
y = (c*d - a*f) / (b*d - a*e)
x = (c - b*y) / a
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,585
|
s770288504
|
p00004
|
u606639970
|
1543027039
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5588
| 275
|
import sys
for line in sys.stdin:
a, b, c, d, e, f = [float(x) for x in line.split()]
x = (f * b - e * c) / (d * b - a * e)
y = (c - a * x) / b
if abs(x) < 0.00001:
x = 0.000
if abs(y) < 0.00001:
y = 0.000
print("%.3f %.3f" % (x, y) )
|
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,586
|
s001935034
|
p00004
|
u067299340
|
1542013972
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5620
| 267
|
while True:
try:
a, b, c, d, e, f = [int(x) for x in input().split()]
x = round((b*f - c*e)/(b*d - a*e), 3) + 0
y = round((a*f - c*d)/(a*e - b*d), 3) + 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,587
|
s183319146
|
p00004
|
u219940997
|
1537191152
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5592
| 255
|
while True:
try:
a, b, c, d, e, f = map(float, input().split())
n = a*e - b*d
if n != 0:
x = (c*e - b*f) / n
y = (a*f - c*d) / n
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,588
|
s010129517
|
p00004
|
u319725914
|
1533910021
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5580
| 185
|
while(True):
try:
a,b,c,d,e,f = map(float, input().split())
y = (a*f-c*d)/(a*e-b*d)
x = (c-b*y)/a
print("%.3f %.3f"%(x,y))
except:
break
|
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,589
|
s842087483
|
p00004
|
u938878704
|
1533104365
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5628
| 353
|
ans = []
while True :
try :
s = input()
a, b, c, d, e, f = map(int, s.split())
y = (((d * c) / a - f) / ((d * b) / a - e))
x = ((c - (b * y)) / a)
ans.append([x, y])
except :
for a in ans :
print('{:.3f} {:.3f}'.format(round(a[0], 3), round(a[1], 3)))
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,590
|
s140467624
|
p00004
|
u930302179
|
1532254982
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5588
| 340
|
EPS=0.0001
while True:
try:
a,b,c,d,e,f = [float(item) for item in input("").split(" ")]
x1=(e*c-b*f)/(a*e-b*d)+EPS
y1=(-c*d+a*f)/(a*e-b*d)+EPS
#a,b,c,d,e,f = [float(item) for item in input("").split(" ")]
#x2=(e*c-b*f)/(a*e-b*d+EPS)
#y2=(-c*d+a*f)/(a*e-b*d+EPS)
print('{0:.3f} {1:.3f}'.format(x1,y1))
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,591
|
s883352466
|
p00004
|
u853158149
|
1521963635
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5588
| 322
|
while 1:
try:
a,b,c,d,e,f = map(float, input().split(" "))
det = a*e-b*d
x = (c*e-b*f)/det
y = (a*f-c*d)/det
if abs(x) < 0.0001:
x = 0.0
if abs(y) < 0.0001:
y = 0.0
print("{0:.3f}".format(x),"{0:.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,592
|
s746123387
|
p00004
|
u214781794
|
1478014925
|
Python
|
Python3
|
py
|
Accepted
| 20
|
7428
| 205
|
while True:
try:
a, b, c, d, e, f = map(float, input().split())
y = (a*f - c*d) / (a*e - b*d)
x = (c - b*y) / a
print ("%0.3f %0.3f" % (x, y))
except:
break
|
p00004
|
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
|
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
|
-1.000 2.000
1.000 4.000
| 3,593
|
s432630919
|
p00004
|
u079141094
|
1467249570
|
Python
|
Python3
|
py
|
Accepted
| 20
|
7632
| 464
|
ss = input().split()
while ss:
a,b,c,d,e,f = map(int, ss)
# A = [[a,b],[d,e]]
C = [c,f]
detA = a*e - b*d
if detA == 0: raise # det(A) == 0.
At = [[e,-b],[-d,a]]
x = sum(map((lambda x,y: x*y), At[0], C)) / detA
y = sum(map((lambda x,y: x*y), At[1], C)) / detA
fx,fy = '{0:.3f}'.format(x), '{0:.3f}'.format(y)
if fx == '-0.000': fx = fx[1:]
if fy == '-0.000': fy = fy[1:]
print('{0} {1}'.format(fx,fy))
try: ss = input().split()
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,594
|
s005114193
|
p00004
|
u197615660
|
1372233722
|
Python
|
Python
|
py
|
Accepted
| 20
|
4272
| 359
|
while True:
try:
data = map(float, raw_input().split())
[a, b, c, d, e, f] = data
n = (c*e - b*f)
m = (a*f - c*d)
i = (a*e - b*d)
x = float(n) / (i)
y = float(m) / (i)
x = '%.3f' % (round(x,3))
y = '%.3f' % (round(y,3))
if x == '-0.000':
x = '0.000'
if y == '-0.000':
y = '0.000'
print 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,595
|
s487130866
|
p00005
|
u539753516
|
1531569816
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5652
| 138
|
import math
while True:
try:
a,b=map(int,input().split())
print(*[math.gcd(a,b),a*b//math.gcd(a,b)])
except:break
|
p00005
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
8 6
50000000 30000000
|
2 24
10000000 150000000
| 3,596
|
s594523890
|
p00005
|
u525366883
|
1535420979
|
Python
|
Python
|
py
|
Accepted
| 10
|
4632
| 201
|
def gcd(a,b):
while b != 0:
a, b = b, a % b
return a
while True:
try:
a, b = map(int, raw_input().split())
print gcd(a, b), a*b/ gcd(a,b)
except:
break
|
p00005
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
8 6
50000000 30000000
|
2 24
10000000 150000000
| 3,597
|
s489812382
|
p00005
|
u011621222
|
1545237628
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5664
| 147
|
import math
while True:
try:
a,b = map(int,input().split())
print(math.gcd(a,b),a*b//math.gcd(a,b))
except:
break
|
p00005
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
8 6
50000000 30000000
|
2 24
10000000 150000000
| 3,598
|
s535279251
|
p00005
|
u179046735
|
1555896390
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5604
| 271
|
def gcd(n1,n2):
if n2==0:
return n1
return gcd(n2,n1%n2)
def lcm(n1,n2):
return n1/gcd(n1,n2)*n2
while True:
try:
a,b=[int(i) for i in input().split()]
print("{} {}".format(int(gcd(a,b)),int(lcm(a,b))))
except:
break
|
p00005
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
8 6
50000000 30000000
|
2 24
10000000 150000000
| 3,599
|
s357597334
|
p00005
|
u150337404
|
1408257987
|
Python
|
Python
|
py
|
Accepted
| 10
|
4212
| 338
|
import sys
while 1:
line = sys.stdin.readline()
if (not line):
break
x, y = map(int, line.split())
if (x > y):
gcd = x
t = y
else :
gcd = y
t = x
while (t > 0) :
tmp = gcd % t
gcd = t
t = tmp
lcm = x * y / gcd
print str(gcd) + " " + str(lcm)
|
p00005
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
8 6
50000000 30000000
|
2 24
10000000 150000000
| 3,600
|
s185329253
|
p00005
|
u450407555
|
1409273440
|
Python
|
Python
|
py
|
Accepted
| 10
|
4204
| 157
|
import sys
def gcd(a,b):
if b == 0: return a
else: return gcd(b,a%b)
for i in sys.stdin:
a, b = map(int, i.split())
g = gcd(a,b)
print g, a/g*b
|
p00005
|
<H1>GCD and LCM</H1>
<p>
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given <var>a</var> and <var>b</var>.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. Each data set contains <var>a</var> and <var>b</var> separated by a single space in a line. The input terminates with EOF.
</p>
<h2>Constraints</h2>
<ul>
<li> 0 < <var>a, b</var> ≤ 2,000,000,000</li>
<li> LCM(<var>a, b</var>) ≤ 2,000,000,000</li>
<li> The number of data sets ≤ 50</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print GCD and LCM separated by a single space in a line.
</p>
<H2>Sample Input</H2>
<pre>
8 6
50000000 30000000
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 24
10000000 150000000
</pre>
|
8 6
50000000 30000000
|
2 24
10000000 150000000
| 3,601
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.