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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s884581075 | p00003 | u990228206 | 1550820611 | Python | Python3 | py | Accepted | 40 | 5612 | 269 | n=int(input())
for i in range(n):
x=list(map(float,input().split()))
if x[0]**2+x[1]**2==x[2]**2:
print("YES")
elif x[1]**2+x[2]**2==x[0]**2:
print("YES")
elif x[2]**2+x[0]**2==x[1]**2:
print("YES")
else:
print("NO")
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,202 |
s445146629 | p00003 | u811314383 | 1550814812 | Python | Python3 | py | Accepted | 40 | 5600 | 202 | N = int(input())
for i in range(N):
tri = list(map(int, input().split()))
tri.sort()
if tri[2]**2 == tri[0]**2 + tri[1]**2:
print('YES')
else:
print('NO')
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,203 |
s013760676 | p00003 | u195186080 | 1550658519 | Python | Python3 | py | Accepted | 40 | 5596 | 210 | input_num = int(input())
for i in range(input_num):
sides = list(map(int, input().split()))
sides.sort()
a, b, c = sides
if a*a + b*b == c*c:
print('YES')
else:
print('NO')
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,204 |
s731857704 | p00003 | u733798831 | 1550490006 | Python | Python3 | py | Accepted | 30 | 5740 | 247 | N=int(input())
for a,b,c in [[int(i) for i in input().split(" ")] for k in range(N)]:
if b*b+c*c==a*a:
print("YES")
elif a*a+c*c==b*b:
print("YES")
elif a*a+b*b==c*c:
print("YES")
else:
print("NO")
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,205 |
s319676294 | p00003 | u051394180 | 1549150069 | Python | Python | py | Accepted | 20 | 4652 | 284 | def judge_triangle(edges):
edges.sort(reverse = True)
if edges[0]**2 == edges[1]**2 + edges[2]**2:
return 'YES'
else:
return 'NO'
lines = int(input())
for i in range(lines):
edges = list(map(int, raw_input().split()))
print judge_triangle(edges)
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,206 |
s793235999 | p00003 | u537067968 | 1549006974 | Python | Python3 | py | Accepted | 40 | 5600 | 168 | #import math
for n in range(int(input())):
a,b,c = sorted(map(int,input().split()))
if a**2 + b**2 == c**2:
print("YES")
else:
print("NO")
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,207 |
s677191322 | p00003 | u689047545 | 1547011635 | Python | Python3 | py | Accepted | 40 | 5596 | 168 | for i in range(int(input())):
(a, b, c) = sorted(list(map(int, input().split())))
if a**2+b**2 == c**2:
print("YES")
else:
print("NO")
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,208 |
s457878410 | p00003 | u000163577 | 1544975489 | Python | Python3 | py | Accepted | 40 | 5596 | 162 | for i in range(int(input())):
a,b,c = sorted(list(map(int,input().split())))
if a**2 + b**2 == c**2:
print('YES')
else:
print('NO')
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,209 |
s613933204 | p00003 | u921810101 | 1544866964 | Python | Python3 | py | Accepted | 50 | 5604 | 172 | for _ in range(int(input())):
a,b,c = [int(x) for x in input().split()]
print("YES" if a**2 == b**2 + c**2 or b**2 == a**2 + c**2 or c**2 == a**2 + b**2 else "NO")
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,210 |
s492405421 | p00003 | u080014366 | 1543763157 | Python | Python3 | py | Accepted | 40 | 5596 | 233 | h=int(input())
for i in range(0, h):
n=list(map(int, input().split()))#ファイルの読み込み --.py <--.txt
a=n[0]
b=n[1]
c=n[2]
if a**2+b**2==c**2 or b**2+c**2==a**2 or c**2+a**2==b**2:
print("YES")
else:
print("NO")
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,211 |
s972095076 | p00003 | u573115711 | 1543070479 | Python | Python3 | py | Accepted | 30 | 5596 | 246 | import sys
datasets = int(input())
for _ in range(datasets):
data = list(map(int, input().strip().split(" ")))
data.sort()
if data[0]*data[0] + data[1]*data[1] == data[2]*data[2]:
print("YES")
else:
print("NO")
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,212 |
s055387551 | p00003 | u606639970 | 1543025363 | Python | Python3 | py | Accepted | 40 | 5604 | 273 | n = int(input() )
for i in range(n):
a, b, c = [int(x) for x in input().split()]
if (b > a):
a, b = b, a
if (c > a):
a, c = c, a #a = max
if (b*b + c*c - a*a == 0):
print("YES")
else:
print("NO")
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,213 |
s855930592 | p00003 | u221424603 | 1542039173 | Python | Python3 | py | Accepted | 30 | 5748 | 272 | N=int(input())
triangle=[]
for i in range(N):
triangle.append(list(map(int,input().split())))
for i in range(N):
if pow(triangle[i][0],2)+pow(triangle[i][1],2)+pow(triangle[i][2],2)==2*pow(max(triangle[i]),2):
print("YES")
else:
print("NO")
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,214 |
s364705937 | p00003 | u067299340 | 1542012721 | Python | Python3 | py | Accepted | 40 | 5608 | 138 | for i in range(int(input())):
a, b, c = sorted([int(x) for x in input().split()])
print('YES' if (a**2 + b**2 == c**2) else 'NO')
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,215 |
s964351512 | p00003 | u563075864 | 1541751589 | Python | Python3 | py | Accepted | 40 | 5604 | 182 | i = int(input())
for j in range(i):
a,b,c = [int(i) for i in input().split()]
if a**2+b**2==c**2 or abs(a**2-b**2)==c**2:
print("YES")
else:
print("NO")
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,216 |
s026153328 | p00003 | u717526540 | 1541575461 | Python | Python3 | py | Accepted | 30 | 5712 | 259 | n = int(input())
ans = []
for _ in range(n):
l = list(map(int, input().split()))
l.sort()
a = l[0]
b = l[1]
c = l[2]
if c**2 == a**2 + b**2:
ans.append("YES")
else:
ans.append("NO")
for a in ans:
print(a)
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,217 |
s784458142 | p00003 | u317583692 | 1539520767 | Python | Python3 | py | Accepted | 40 | 5600 | 236 | def Triangle(a,b,c):
if a**2 == b**2 +c**2 or b**2 == a**2+c**2 or c**2 == a**2+b**2:
print("YES")
else:
print("NO")
N = int(input())
for i in range(N):
a,b,c = map(int,input().split())
Triangle(a,b,c)
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,218 |
s324227176 | p00003 | u657361950 | 1539059622 | Python | Python3 | py | Accepted | 40 | 5600 | 148 | n=int(input())
for i in range(n):
a=sorted(list(map(int,input().split())))
if a[0]*a[0]+a[1]*a[1]==a[2]*a[2]:
print('YES')
else:
print('NO')
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,219 |
s239485865 | p00003 | u219940997 | 1537189890 | Python | Python3 | py | Accepted | 40 | 5596 | 174 | n = int(input())
for _ in range(n):
num = sorted(map(int, input().split()))
if num[0]**2 + num[1]**2 == num[2]**2:
print("YES")
else:
print("NO")
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,220 |
s960853186 | p00003 | u788547157 | 1536975050 | Python | Python3 | py | Accepted | 30 | 5720 | 335 | def isRightTri(list):
list.sort()
if list[2]**2 == list[0]**2 + list[1]**2:
return True
else:
return False
n = int(input())
ans = []
for i in range(n):
a = list(map(int,input().split()))
ans.append(isRightTri(a))
for i in range(n):
if ans[i]:
print("YES")
else:
print("NO")
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,221 |
s352834469 | p00003 | u923573620 | 1536278032 | Python | Python3 | py | Accepted | 40 | 5676 | 324 | import math
num = int(input())
for i in range(num):
try:
sides = list(map(int, input().split(" ")))
sides.sort()
if int(math.pow(sides[0], 2)) + int(math.pow(sides[1], 2)) == int(math.pow(sides[2], 2)):
print("YES")
else:
print("NO")
except:
break
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,222 |
s796325726 | p00003 | u319725914 | 1533909696 | Python | Python3 | py | Accepted | 40 | 5600 | 155 | for _ in range(int(input())):
a,b,c = sorted(list(map(int, input().split())))
if c*c==a*a+b*b:
print("YES")
else :
print("NO")
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,223 |
s336913344 | p00003 | u938878704 | 1533103449 | Python | Python3 | py | Accepted | 30 | 5716 | 244 | N = int(input())
ans = []
for i in range(N) :
a, b, c = sorted(list(map(int, input().split())))
if a ** 2 + b ** 2 == c ** 2 :
ans.append("YES")
else :
ans.append("NO")
for a in ans :
print(a)
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,224 |
s928594938 | p00003 | u252700163 | 1532611219 | Python | Python3 | py | Accepted | 40 | 5604 | 212 | s = int(input())
for i in range(s):
xs = map(int, input().split())
xs = [x*x for x in xs]
if xs[0]+xs[2] == xs[1] or xs[1]+xs[0] == xs[2] or xs[2]+xs[1]==xs[0]:
print('YES')
else:
print('NO')
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,225 |
s223485614 | p00003 | u853158149 | 1521961907 | Python | Python3 | py | Accepted | 30 | 5716 | 222 | n = int(input())
ans = []
for i in range(n):
a, b, c = map(int, (input()).split(" "))
if 2*max(a, b, c)**2 == a**2+b**2+c**2:
ans.append("YES")
else:
ans.append("NO")
for i in ans:
print(i)
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,226 |
s472062719 | p00003 | u026918310 | 1486317362 | Python | Python | py | Accepted | 20 | 6336 | 122 | n=input()
for _ in range(n):
a=sorted(map(int, raw_input().split()))
print 'YES' if a[0]**2+a[1]**2==a[2]**2 else 'NO'
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,227 |
s981182047 | p00003 | u214781794 | 1478013535 | Python | Python3 | py | Accepted | 50 | 7668 | 238 | N = int(input())
for i in range(0, N):
edge = list(map(int, input().split()))
edge.sort()
edge = list(map(lambda n:n*n, edge))
if (edge[2] == edge[0] + edge[1]):
print("YES")
else:
print("NO")
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,228 |
s727108403 | p00003 | u079141094 | 1467209326 | Python | Python3 | py | Accepted | 40 | 7688 | 186 | n = int(input())
for _ in range(n):
tr = list(map(int, input().split()))
c = max(tr)
tr.remove(c)
wa = sum(map((lambda x: x**2), tr))
if c**2 == wa: print('YES')
else: print('NO')
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,229 |
s584552323 | p00003 | u822200871 | 1447519572 | Python | Python3 | py | Accepted | 50 | 7576 | 324 | num = int(input())
output = []
data = []
for x in range(num):
data = input().split()
for y in range(len(data)):
data[y] = int(data[y])
data.sort()
if data[2]**2 == data[1]**2 + data[0]**2:
output.append("YES")
else:
output.append("NO")
for x in range(num):
print(output[x])
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,230 |
s440360455 | p00003 | u197615660 | 1372072752 | Python | Python | py | Accepted | 20 | 4252 | 236 | time = input()
judge = [''] * 1000
for i in range(time):
data = map(int, raw_input().split())
[a, b, c] = sorted(data)
if a ** 2 + b ** 2 == c ** 2:
judge[i] = 'YES'
else:
judge[i] = 'NO'
for j in range(i+1):
print judge[j]
| p00003 |
<H1>Is it a Right Triangle?</H1>
<p>
Write a program which judges wheather given length of three side form a right triangle. Print "<span>YES</span>" if the given sides (integers) form a right triangle, "<span>NO</span>" if not so.
</p>
<H2>Input</H2>
<p>
Input consists of several data sets. In the first line, the number of data set, <var>N</var> is given. Then, <var>N</var> lines follow, each line corresponds to a data set. A data set consists of three integers separated by a single space.
</p>
<h2>Constraints</h2>
<ul>
<li> 1 ≤ length of the side ≤ 1,000</li>
<li> <var>N</var> ≤ 1,000</li>
</ul>
<H2>Output</H2>
<p>
For each data set, print "<span>YES</span>" or "<span>NO</span>".
</p>
<H2>Sample Input</H2>
<pre>
3
4 3 5
4 3 6
8 8 8
</pre>
<H2>Output for the Sample Input</H2>
<pre>
YES
NO
NO
</pre>
| 3
4 3 5
4 3 6
8 8 8
| YES
NO
NO
| 3,231 |
s131967940 | p00004 | u539753516 | 1531569381 | Python | Python3 | py | Accepted | 20 | 5616 | 176 | while True:
try:
a,b,c,d,e,f=map(int,input().split())
print("{0:.3f} {1:.3f}".format((c*e-b*f)/(a*e-b*d)+1e-10,(a*f-c*d)/(a*e-b*d)+1e-10))
except:break
| p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,232 |
s965021203 | p00004 | u525366883 | 1535420146 | Python | Python | py | Accepted | 10 | 4652 | 186 | while True:
try:
a, b, c, d, e, f = map(float, raw_input().split())
except:
break
y = (c*d-a*f)/(b*d-a*e)
x=(c - b*y) / a
print "%.3f %.3f" % (x, y)
| p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,233 |
s349184928 | p00004 | u923573620 | 1535691615 | Python | Python3 | py | Accepted | 20 | 5608 | 192 | 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,234 |
s687894772 | p00004 | u978863922 | 1540905243 | Python | Python3 | py | Accepted | 20 | 5616 | 266 | while True:
try:
(a,b,c,d,e,f) = map(int,input().split())
except:
break
g = (a * e) - (b * d)
ans1= "{0:.3f}".format((( e * c) + ( -b * f)) / g + 0)
ans2= "{0:.3f}".format(((-d * c) + ( a * f)) / g + 0)
print (ans1,ans2)
| p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,235 |
s367512495 | p00004 | u000163577 | 1546187441 | Python | Python3 | py | Accepted | 20 | 5576 | 277 | 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,236 |
s147254113 | p00004 | u979795132 | 1555686407 | Python | Python3 | py | Accepted | 20 | 5600 | 680 | def equation(a,b,c,d,e,f,x):
buff = a*e-b*d
buff_a = a
a = e/buff
b = -b/buff
d = -d/buff
e = buff_a/buff
x.append((a*c)+(b*f))
x.append((d*c)+(e*f))
count = 0
a = []
b = []
c = []
d = []
e = []
f = []
while True:
try:
buff = input().split()
a.append(float(buff[0]))
b.append(float(buff[1]))
c.append(float(buff[2]))
d.append(float(buff[3]))
e.append(float(buff[4]))
f.append(float(buff[5]))
count += 1
except:
break
for i in range(count):
ans = []
equation(a[i],b[i],c[i],d[i],e[i],f[i],ans)
print('{:.3f}'.format(ans[0]),'{:.3f}'.format(ans[1]))
| p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,237 |
s476597336 | p00004 | u179046735 | 1555842017 | Python | Python3 | py | Accepted | 20 | 5624 | 288 | while True:
try:
a,b,c,d,e,f=[int(i) for i in input().split()]
x=(c*e-f*b)/(a*e-b*d)
y=(a*f-d*c)/(a*e-b*d)
if abs(x)<1e-4:
x=0.0
if abs(y)<1e-4:
y=0.0
print("{:.3f} {:.3f}".format(x,y))
except:
break
| p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,238 |
s550836910 | p00004 | u831725332 | 1555844120 | Python | Python3 | py | Accepted | 20 | 5576 | 344 | #det = ae - bd
#x = (ce - bf) / det
#y = (af - cd) / det
#-0.000 対策
EPS = 1e-4
while True:
try:
a, b, c, d, e, f = map(float, input().split())
det = a*e - b*d
x = (c*e - b*f) / det + EPS
y = (a*f - c*d) / det + EPS
print('{0:.3f} {1:.3f}'.format(x, y))
except EOFError:
break
| p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,239 |
s436803611 | p00004 | u506537276 | 1559537140 | Python | Python3 | py | Accepted | 20 | 5600 | 876 | while True:
try:
a, b, c, d, e, f = map(float, input().split())
except EOFError:
break
det = a * e - b * d
if det != 0:
x = (1 / det) * (e * c - b * f)
y = (1 / det) * (a * f - c * d)
if x >= 0:
xx = (int)(x * 1000)
if xx % 10 <= 4:
ansx = (xx - xx%10) / 1000
else:
ansx = (xx + (10 - xx%10)) / 1000
else:
xx = (int)(x * -1000)
if xx % 10 <= 4:
ansx = (xx - xx%10) / -1000
else:
ansx = (xx + (10 - xx%10)) / -1000
if y >= 0:
yy = (int)(y * 1000)
if yy % 10 <= 4:
ansy = (yy - yy%10) / 1000
else:
ansy = (yy + (10 - yy%10)) / 1000
else:
yy = (int)(y * -1000)
if yy % 10 <= 4:
ansy = (yy - yy%10) / -1000
else:
ansy = (yy + (10 - yy%10)) / -1000
print("{0:.3f} {1:.3f}".format(ansx, ansy))
| p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,240 |
s362421982 | p00004 | u385497113 | 1409304751 | Python | Python | py | Accepted | 10 | 4240 | 454 | #! -*- coding: utf-8-unix -*-
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0004
import sys
def main_(a,b,c,d,e,f):
y = (a*f-d*c)/(a*e-d*b)
x = (c - b * y) / a
return (x, y)
def main(lines):
for line in lines:
a,b,c,d,e,f = map(float, line.split(' '))
print '%.3f %.3f' % main_(a,b,c,d,e,f)
return
if __name__=='__main__':
lines = []
for line in sys.stdin:
lines.append(line.strip())
# print lines
main(lines) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,241 |
s202208086 | p00004 | u696166817 | 1409409351 | Python | Python3 | py | Accepted | 30 | 6752 | 488 | while True:
try:
a, b, c, d, e, f = map(int, input().strip("\n").split(" "))
z = a * e - b * d
if z == 0:
break
x = (c * e - b * f)
y = (f * a - c * d)
x /= z
y /= z
# zero toshite atsukau
if -0.0004 < x < 0.0004:
x = abs(x)
if -0.0004 < y < 0.0004:
y = abs(y)
print("{0:.3f} {1:.3f}".format(x, y))
except EOFError:
break # escape from while loop | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,242 |
s742779761 | p00004 | u703446356 | 1410894365 | Python | Python | py | Accepted | 10 | 4228 | 216 | while True:
try:
[a, b, c, d, e, f] = map(float, raw_input().split())
i = d/a
j = i * b - e
k = i * c - f
y = float(k/j)
x = float((c - b * y)/a)
print "%.3f %.3f" % (x, y)
except (EOFError):
break; | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,243 |
s318865595 | p00004 | u855866586 | 1412155420 | Python | Python | py | Accepted | 10 | 4244 | 264 | while True:
try:
(a,b,c,d,e,f)=map(float,raw_input().split())
x=(f-c*e/b)/(d-a*e/b)
y=(c-a*x)/b
if abs(x)<1e-3:
x=0
if abs(y)<1e-3:
y=0
print "%.3f %.3f" % (x,y)
except EOFError: break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,244 |
s372147686 | p00004 | u506132575 | 1416098096 | Python | Python | py | Accepted | 10 | 4240 | 286 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
for s in sys.stdin:
d = map( float, s.split() )
det = d[0]*d[4]-d[1]*d[3]
x = ( d[4]*d[2]-d[1]*d[5] ) / det
y = ( -d[3]*d[2]+d[0]*d[5] ) / det
if x == 0:
x = 0
if y == 0:
y = 0
print "%.3f %.3f" % ( x, y ) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,245 |
s756965233 | p00004 | u310737167 | 1416677857 | Python | Python3 | py | Accepted | 30 | 6808 | 213 | import math
import itertools
while 1:
try:
a, b, c, d, e, f = map(int, input().split())
print('{0:.3f} {1:.3f}'.format((e*c-b*f)/(a*e-b*d)+0, (-d*c+a*f)/(a*e-b*d)+0))
except:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,246 |
s680381341 | p00004 | u310737167 | 1416678867 | Python | Python3 | py | Accepted | 30 | 6748 | 190 | while 1:
try:
a, b, c, d, e, f = map(int, input().split())
y = (-d*c+a*f)/(a*e-b*d)
print('{:.3f} {:.3f}'.format((c-b*y)/a, y))
except EOFError:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,247 |
s044361000 | p00004 | u379499530 | 1418312812 | Python | Python | py | Accepted | 10 | 4220 | 235 | while 1:
try:
i = raw_input()
a, b, c, d, e, f = map(float, i.split())
y = ((c * d) - (a * f)) / ((b * d) - (a * e))
x = (c - (b * y)) / a
print "%.3f %.3f" % (x, y)
except:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,248 |
s531225038 | p00004 | u672822075 | 1418963643 | Python | Python3 | py | Accepted | 30 | 6736 | 153 | while True:
try:
a,b,c,d,e,f = map(float,input().split())
y=(a*f-c*d)/(a*e-b*d)
x=(c-b*y)/a
print('{:.3f} {:.3f}'.format(x,y))
except:
break; | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,249 |
s997343135 | p00004 | u336443042 | 1421712204 | Python | Python | py | Accepted | 10 | 4216 | 239 | import sys
for line in sys.stdin.readlines():
a, b, c, d, e, f = map(float, line.strip().split())
y = ((c * d) - (a * f)) / ((b * d) - (a * e))
x = (c - (b * y)) / a
print "{0:.3f}".format(x),
print "{0:.3f}".format(y) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,250 |
s174482516 | p00004 | u607831289 | 1422373958 | Python | Python | py | Accepted | 20 | 4280 | 326 | # coding: utf8
import sys
for line in sys.stdin:
a, b, c, d, e, f = map(float, line.split())
if (c * e - b * f) == 0:
x = 0.0
else:
x = round((c*e-b*f)/(a*e-b*d), 3)
if (c * d - a * f) == 0:
y = 0.0
else:
y = round((c*d-a*f)/(b*d-a*e), 3)
print '%.3f %.3f' % (x, y) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,251 |
s007973450 | p00004 | u422939201 | 1422457744 | Python | Python | py | Accepted | 10 | 4212 | 152 | import sys
for s in sys.stdin:
a, b, c, d, e, f = map(float, s.split())
y = (a*f - d*c)/(a*e - d*b)
x = (c - b*y)/a
print '%.03f %.03f'%(x, y) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,252 |
s648289586 | p00004 | u567380442 | 1422531571 | Python | Python3 | py | Accepted | 30 | 6744 | 277 | import sys
for line in sys.stdin:
a, b, c, d, e, f = map(int, line.split())
y = (a * f - d * c) / (a * e - b * d)
x = (c * e - b * f) / (a * e - b * d)
if x == 0: x = abs(x)
if y == 0: x = abs(y)
print('{:.3f} {:.3f}'.format(x, y)) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,253 |
s861102555 | p00004 | u241133982 | 1422947644 | Python | Python | py | Accepted | 10 | 4216 | 220 | from __future__ import division
while True:
try:
a, b, c, d, e, f = map(int, raw_input().split())
D = a*e - b*d
Dx = c*e - b*f
Dy = a*f - c*d
print("%.3f %.3f" % (Dx/D + 0, Dy/D + 0))
except EOFError:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,254 |
s867616555 | p00004 | u839573768 | 1422958222 | Python | Python | py | Accepted | 10 | 4236 | 260 | while True:
try:
a,b,c,d,e,f = map(int, raw_input().split())
x = float(c*e-b*f)/(a*e-b*d)
y = float(-d*c+a*f)/(a*e-b*d)
print '%.3f %.3f' %(round(x,3) + 0, round(y,3) + 0)
except EOFError:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,255 |
s884666495 | p00004 | u442472098 | 1423228632 | Python | Python3 | py | Accepted | 30 | 6788 | 1,033 | #!/usr/bin/env python3
import sys
def Print(array):
for r in range(len(array)):
print(array[r])
print()
def Gauss(array):
# for r in range(len(array)):
# array[r].append(r)
for r in range(len(array)):
# array.sort(key=lambda x: x[r], reverse=True)
div = array[r][r]
for c in range(r, len(array) + 1):
array[r][c] /= div
for r2 in range(r + 1, len(array)):
head = array[r2][r]
for c in range(r, len(array) + 1):
array[r2][c] -= head * array[r][c]
result = [0] * len(array)
for r in range(len(array) - 1, -1, -1):
result[r] = array[r][
len(array)] - sum([result[x] * array[r][x] for x in range(r + 1, len(array))])
return result
for line in sys.stdin:
[a, b, c, d, e, f] = [int(x) for x in line.split()]
result = Gauss([[a, b, c], [d, e, f]])
for i in range(len(result) - 1):
print("{0:.3f}".format(result[i]), end=" ")
print("{0:.3f}".format(result[-1])) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,256 |
s192332390 | p00004 | u879226672 | 1423267169 | Python | Python | py | Accepted | 10 | 4244 | 356 | while True:
try:
a,b,c,d,e,f = map(float,raw_input().split())
delta =a*e-b*d
x = (e*c-b*f)/delta
y = (a*f-d*c)/delta
if abs(x)<1e-3:
x=0
if abs(y)<1e-3:
y=0
#print str('%.3f' % x) + " " + str('%.3f' % y)
print "%.3f %.3f" % (x,y)
except EOFError:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,257 |
s336309149 | p00004 | u744114948 | 1423636760 | Python | Python3 | py | Accepted | 20 | 6748 | 263 | #! /usr/bin/python3
while True:
try:
l=list(map(int, input().split()))
x=(l[1]*l[5]-l[2]*l[4])/(l[1]*l[3]-l[0]*l[4])
y=(l[2]-l[0]*x)/l[1]
if x == 0: x = 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,258 |
s677654405 | p00004 | u349293999 | 1423841882 | Python | Python | py | Accepted | 20 | 4220 | 236 | import sys
for line in sys.stdin:
a, b, c, d, e, f = map(int, line.rstrip('\n').split(' '))
x = int((e*c - b*f) * 1000 / (a*e - b*d)) / 1000.0
y = int((a*f - d*c) * 1000 / (a*e - b*d)) / 1000.0
print '%.3f %.3f' % (x, y) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,259 |
s582743626 | p00004 | u349293999 | 1423842927 | Python | Python | py | Accepted | 10 | 4260 | 400 | import sys
out=[]
for line in sys.stdin.readlines():
num = map(float, line.strip().split())
x = (num[2]*num[4] - num[1]*num[5]) / (num[0]*num[4] - num[1]*num[3])
y = (num[5]*num[0] - num[2]*num[3]) / (num[0]*num[4] - num[3]*num[1])
if x == 0:
x=0.00
if y == 0:
y=0.00
out.append( "%.3f %.3f"%(round(x,3),round(y,3)))
for i in xrange(len(out)):
print out[i] | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,260 |
s501339659 | p00004 | u392445270 | 1424439962 | Python | Python | py | Accepted | 10 | 4248 | 262 | while True:
try:
temp = [float(x) for x in raw_input().split()]
y = float(temp[0]*temp[5] - temp[3]*temp[2]) / (temp[0]*temp[4]-temp[3]*temp[1])
x = float(temp[2] - temp[1]*y) / temp[0]
print "%.3f %.3f" % (round(x, 3), round(y, 3))
except:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,261 |
s499221325 | p00004 | u540744789 | 1425573740 | Python | Python | py | Accepted | 20 | 4256 | 313 | import sys
for abcdef in sys.stdin:
a,b,c,d,e,f = map(float,abcdef.split(" "))
if a!=0:
y=(a*f-c*d)/(a*e-b*d)
y=round(y,3)
x=(c-b*y)/a
x=round(x,3)
else:
y=c/b
y=round(y,3)
x=(f-e*y)/d
x=round(x,3)
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,262 |
s462212428 | p00004 | u040533857 | 1425975128 | Python | Python3 | py | Accepted | 30 | 6752 | 376 | while True:
try:
a,b,c,d,e,f = map(int,input().split(' '))
z = a*e-b*d
if z==0:
break
x = c*e-b*f
y = a*f-c*d
x /= z
if -0.0004 < x < 0.0004:
x = abs(x)
y /= z
if -0.0004 < y < 0.0004:
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,263 |
s405519373 | p00004 | u355726239 | 1426739371 | Python | Python3 | py | Accepted | 30 | 6744 | 272 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
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 - d*c) / (a*e - b*d)
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,264 |
s140395277 | p00004 | u886766186 | 1430314828 | Python | Python | py | Accepted | 20 | 4384 | 466 | # coding: utf-8
# import numpy as np
import sys
import math
def _read():
for i in sys.stdin:
yield map(int, i.split())
def _round(decimal):
rounded = round(decimal * 1000) / 1000
if rounded == -0.0:
rounded = +0.0
return rounded
for d in _read():
[a,b,c,d,e,f] = map(float, d)
dat = a * e - b * d
x = (c * e - b * f) / dat
y = (a * f - c * d) / dat
[x, y] = map(_round, [x, y])
print "%1.3f %1.3f" % (x, y) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,265 |
s570547977 | p00004 | u009961299 | 1430853532 | Python | Python3 | py | Accepted | 30 | 6828 | 336 | # -*- coding: utf-8 -*-
import math
while True:
try:
( a, b, c, d, e, f ) = map ( float, input ( ).split ( ) )
except EOFError: break
x = ( c * e - b * f ) / ( a * e - b * d )
y = ( a * f - c * d ) / ( a * e - b * d )
print ( "%.3f %.3f" % ( math.floor ( x * 1000 + 0.5 ) / 1000, math.floor ( y * 1000 + 0.5 ) / 1000 ) ) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,266 |
s344624866 | p00004 | u009961299 | 1430853738 | Python | Python3 | py | Accepted | 30 | 6828 | 310 | # -*- coding: utf-8 -*-
import math
while True:
try:
( a, b, c, d, e, f ) = map ( float, input ( ).split ( ) )
except EOFError: break
x = ( c * e - b * f ) / ( a * e - b * d )
y = ( a * f - c * d ) / ( a * e - b * d )
print ( "%.3f %.3f" % ( round ( x * 1e3 ) / 1e3, round ( y * 1e3 ) / 1e3 ) ) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,267 |
s697085934 | p00004 | u308369184 | 1431002237 | Python | Python3 | py | Accepted | 30 | 6756 | 330 | while True:
try:
line=input()
except:
break
a,b,c,d,e,f=map(int, line.strip().split())
y=(c*d-f*a)/(b*d-a*e)
x=(c*e-f*b)/(a*e-b*d)
if x<=0 and x>=-0.0005:
x=0.000
if y<=0 and y>=-0.0005:
y=0.000
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,268 |
s837688686 | p00004 | u520870854 | 1431704135 | Python | Python | py | Accepted | 10 | 4240 | 337 | # -*- coding: utf-8 -*-
while True:
try:
list = [float(x) for x in raw_input().split() ]
x = (list[2]*list[4]-list[1]*list[5])/(list[0]*list[4]-list[1]*list[3])+0
y = (list[0]*list[5]-list[2]*list[3])/(list[0]*list[4]-list[1]*list[3])+0
print("%.3f %.3f" %(x, y))
except EOFError:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,269 |
s144638072 | p00004 | u520870854 | 1431704171 | Python | Python | py | Accepted | 10 | 4244 | 337 | # -*- coding: utf-8 -*-
while True:
try:
list = [float(x) for x in raw_input().split() ]
x = (list[2]*list[4]-list[1]*list[5])/(list[0]*list[4]-list[1]*list[3])+0
y = (list[0]*list[5]-list[2]*list[3])/(list[0]*list[4]-list[1]*list[3])+0
print("%.3f %.3f" %(x, y))
except EOFError:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,270 |
s829233799 | p00004 | u067299340 | 1432560928 | Python | Python | py | Accepted | 20 | 4208 | 121 | import sys
for l in sys.stdin:
a,b,c,d,e,f=map(float,l.split())
x=a*e-b*d
print"%0.3f %0.3f"%(c*e/x-b*f/x,a*f/x-c*d/x) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,271 |
s920373175 | p00004 | u067299340 | 1432560992 | Python | Python | py | Accepted | 10 | 4208 | 121 | import sys
for l in sys.stdin:
a,b,c,d,e,f=map(float,l.split())
x=a*e-b*d
print"%0.3f %0.3f"%(c*e/x-b*f/x,a*f/x-c*d/x) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,272 |
s890392057 | p00004 | u873482706 | 1434192681 | Python | Python | py | Accepted | 20 | 5912 | 1,437 | import sys
from decimal import Decimal
def main():
for input_line in sys.stdin:
x1 = int(input_line.split(' ')[0])
y1 = int(input_line.split(' ')[1])
p = int(input_line.split(' ')[2])
x2 = int(input_line.split(' ')[3])
y2 = int(input_line.split(' ')[4])
q = int(input_line.split(' ')[5])
multiplicand1, multiplicand2 = calculate1(x1, x2)
after_y1, after_y2, after_p, after_q = calculate2(y1, y2, p, q, multiplicand1, multiplicand2)
calculate3(after_y1, after_y2, after_p, after_q, x1, y1, p)
def calculate1(x1, x2):
if (x1 >= 0 and x2 >= 0) or (x1 < 0 and x2 < 0):
multiplicand1 = -x2
multiplicand2 = x1
return multiplicand1, multiplicand2
else:
multiplicand1 = abs(x2)
multiplicand2 = abs(x1)
return multiplicand1, multiplicand2
def calculate2(y1, y2, p, q, multiplicand1, multiplicand2):
after_y1 = Decimal(y1 * multiplicand1)
after_y2 = Decimal(y2 * multiplicand2)
after_p = Decimal(p * multiplicand1)
after_q = Decimal(q * multiplicand2)
return after_y1, after_y2, after_p, after_q
def calculate3(after_y1, after_y2, after_p, after_q, x1, y1, p):
y = Decimal(after_p + after_q) / Decimal(after_y1 + after_y2)
y = round(y, 3)
x = Decimal(p - y1 * y) / Decimal(x1)
x = round(x, 3)
print('%.3f %.3f' % (x, y))
if __name__ == '__main__':
main() | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,273 |
s540881861 | p00004 | u492083164 | 1434795138 | Python | Python3 | py | Accepted | 20 | 6748 | 187 | while(True):
try:
a,b,c,d,e,f=map(float,input().split(" "))
z=a*e-b*d
if(z!=0):
x=(c*e-b*f)/z
y=(a*f-c*d)/z
print("{:.3f} {:.3f}".format(x+0,y+0))
except:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,274 |
s087332284 | p00004 | u565801464 | 1435832019 | Python | Python | py | Accepted | 10 | 4244 | 209 | import sys
WS = sys.stdin.read()[:-1].split('\n')
for W in WS:
a,b,c,d,e,f = map(float,W.split())
x=(b*f-e*c)/(b*d-e*a)
y=(c-a*x)/b
x+=0
y+=0
print '%.3f %.3f' % (round(x,3),round(y,3)) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,275 |
s507358234 | p00004 | u338932851 | 1436242552 | Python | Python | py | Accepted | 20 | 4248 | 370 | import sys
input_lines = sys.stdin.readlines()
lines = map(lambda x: x[:-1], input_lines)
lines = map(lambda x: x.split(" "), lines)
#print lines
for l in lines:
a, b, c, d, e, f = map(float, l)
x = (c*e - b*f) / (e*a - b*d)
y = (f*a - c*d) / (e*a - b*d)
if x == -0.0:
x = 0
if y == -0.0:
y = 0
print "%.3f %.3f" % (x, y) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,276 |
s336792566 | p00004 | u334031393 | 1437531979 | Python | Python3 | py | Accepted | 30 | 6756 | 297 | 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,277 |
s761993087 | p00004 | u472944603 | 1437533762 | Python | Python | py | Accepted | 10 | 4292 | 398 | import sys
eps = float(pow(10,-7))
while (True):
L = map(float, sys.stdin.readline().split())
if L:
(a, b, c, d, e, f) = L
x = (e * c - b * f) / (a * e - b * d)
y = (a * f - d * c) / (a * e - b * d)
if (abs(x) < eps):
x = 0.0
if (abs(y) < eps):
y = 0.0
print "{0:.3f} {1:.3f}".format(x, y)
else:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,278 |
s123367949 | p00004 | u777299405 | 1437650734 | Python | Python3 | py | Accepted | 30 | 6744 | 243 | while True:
try:
a, b, c, d, e, f = map(float, input().split())
z = a * e - b * d
x = (c * e - b * f) / z
y = (a * f - c * d) / z
print("{:.3f} {:.3f}".format(x + 0, y + 0))
except:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,279 |
s772036401 | p00004 | u722431421 | 1439453239 | Python | Python | py | Accepted | 20 | 4240 | 312 | while True:
try:
a1,b1,c1,a2,b2,c2 = map(float,raw_input().split(' '))
det = a1*b2-b1*a2
x = (c1*b2-b1*c2)/det
if not x:
x = 0.
y = (a1*c2-c1*a2)/det
if not y:
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,280 |
s962645727 | p00004 | u802625365 | 1446207379 | Python | Python | py | Accepted | 10 | 6328 | 532 | import sys
x = 0
y = 0
while True:
try:
a,b,c,d,e,f = map(float,raw_input().split())
if a == 0:
y = c / b
x = (f - e * c / b) / d
elif b == 0:
x = c / a
y = (f - d * c / a) / e
elif d == 0:
y = f / e
x = (c - b * f / e) / a
elif e == 0:
x = f / d
y = (c - a * f / d) / b
else:
x = (c*e - b*f) / (a*e - b*d)
y = (c*d - a*f) / (b*d - a*e)
if x == 0:
x = 0.0
if y == 0:
y = 0.0
print "%.3f %.3f" % (x,y)
except EOFError:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,281 |
s250274553 | p00004 | u468759892 | 1449389582 | Python | Python3 | py | Accepted | 20 | 7640 | 268 | while True:
try:
a,b,c,d,e,f = (int(i) for i in input().split())
det=a*e-b*d
x = (c*e-b*f)/det
y = (a*f-c*d)/det
if x==0:x=0
if y==0:y=0
print("{0:.3f} {1:.3f}".format(x,y))
except EOFError:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,282 |
s487568100 | p00004 | u282982700 | 1449557951 | Python | Python | py | Accepted | 10 | 6356 | 130 | import sys
for l in sys.stdin:
a,b,c,d,e,f=map(float,l.split())
x=a*e-b*d
print"%0.3f %0.3f"%(c*e/x-b*f/x,a*f/x-c*d/x) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,283 |
s840455890 | p00004 | u825618558 | 1450030744 | Python | Python3 | py | Accepted | 30 | 7684 | 399 | import sys
lines = sys.stdin.readlines()
for line in lines:
line = line.split(" ")
inp = []
for i in line:
inp.append(int(i))
a = inp[0]
b = inp[1]
c = inp[2]
d = inp[3]
e = inp[4]
f = inp[5]
delta = a*e - b*d
x = (c*e-b*f)/delta
if x==0.0:
x = 0.0
y = (-d*c+a*f)/delta
if y==0.0:
y = 0.0
print("%.3f %.3f" % (x,y)) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,284 |
s135848850 | p00004 | u609881501 | 1450241923 | Python | Python3 | py | Accepted | 30 | 7440 | 482 | import sys
inputNum = sys.stdin.readlines()
for i in inputNum:
new = []
n = i[:-1].split(' ', 6)
for s in n:
new.append(float(s))
k = new[0]
q = 0
for a in new[0:3]:
new[q] = a/k
q = q + 1
l = new[3]
for a in new[3:6]:
new[q] = a - l*new[q-3]
q = q + 1
if new[4] == 0:
y = new[5]
else:
y = new[5]/new[4]
x = new[2]-(new[1]*y)
print("{0:.3f}".format(x)+" "+"{0:.3f}".format(y)) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,285 |
s014085899 | p00004 | u560214129 | 1450498966 | Python | Python3 | py | Accepted | 20 | 7376 | 263 | import sys
for line in sys.stdin.readlines():
a, b, c, d, e, f=map(float,line.split())
k=(a*e)-(b*d)
xval=(c*e)-(b*f)
yval=(a*f)-(c*d)
g=xval/k
h=yval/k
if(xval==0):
g=0
if(yval==0):
h=0
print("%.3f %.3f"%(g,h)) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,286 |
s312557854 | p00004 | u512342660 | 1451372341 | Python | Python | py | Accepted | 10 | 6308 | 270 | import sys
import time
#1.2 2.8 4.12 1.5 3.0 4.5
for line in sys.stdin:
a1,b1,c1,a2,b2,c2 = map(float,line.split())
i=0
x = (c1*b2-c2*b1) / (a1*b2-a2*b1)
y = (a1*c2-a2*c1) / (a1*b2-a2*b1)
if "-0" in str(x):
x = 0.0
print "%.3f %.3f"%(x,y) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,287 |
s972132484 | p00004 | u529386725 | 1452171372 | Python | Python | py | Accepted | 10 | 6316 | 188 | import sys
for line in sys.stdin:
a, b, c, d, e, f = map(float, line.split())
det = a*e-b*d
print '%.3f %.3f' % (round((c*e-b*f)/det, 3)+0.000001, round((a*f-c*d)/det, 3)) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,288 |
s023619521 | p00004 | u580607517 | 1452612322 | Python | Python | py | Accepted | 10 | 6376 | 273 | ar = []
while True:
try:
a, b, c, d, e, f = map(float, raw_input().split())
x = (c * e - b * f) / (a * e - d * b)
y = (c * d - f * a) / (b * d - e * a)
ar.append([x, y])
except:
break
for i in ar:
print("{:.3f} {:.3f}".format(i[0] + 0, i[1] + 0)) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,289 |
s804589238 | p00004 | u797673668 | 1452681931 | Python | Python3 | py | Accepted | 30 | 7664 | 188 | import sys
for line in sys.stdin:
a, b, c, d, e, f = map(int, line.split())
y = (c * d - a * f) / (b * d - a * e)
x = (c - b * y) / a
print('{0:.3f} {1:.3f}'.format(x, y)) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,290 |
s244791253 | p00004 | u386731818 | 1454948855 | Python | Python | py | Accepted | 10 | 6428 | 151 | import sys
for s in sys.stdin:
a, b, c, d, e, f = map(float, s.split())
y = (a*f - d*c)/(a*e - d*b)
x = (c - b*y)/a
print '%.03f %.03f'%(x, y) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,291 |
s334714226 | p00004 | u650459696 | 1455013344 | Python | Python3 | py | Accepted | 30 | 7640 | 404 | import sys
ary=[]
ans=[]
def solve(a,b,c,d,e,f):
if c*e-b*f==0:
x=0
else:
x=(c*e-b*f)/(a*e-b*d)
if c*d-a*f==0:
y=0
else:
y=(c*d-a*f)/(b*d-a*e)
return [x,y]
for i in sys.stdin:
ary.append(list(map(int,i.split())))
ans.append(solve(*ary[-1]))
for i in range(len(ans)):
print('{0:.3f} {1:.3f}'.format(round(ans[i][0],3),round(ans[i][1],3))) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,292 |
s097458096 | p00004 | u982618289 | 1455121729 | Python | Python3 | py | Accepted | 20 | 7360 | 268 | while(True):
try:
a,b,c,d,e,f=map(float,input().split(" "))
z=a*e-b*d
if(z!=0):
x=(c*e-b*f)/z
y=(a*f-c*d)/z
print("{:.3f} {:.3f}".format(x+0,y+0))
except:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,293 |
s206277125 | p00004 | u982618289 | 1455122113 | Python | Python3 | py | Accepted | 30 | 7356 | 268 | while(True):
try:
a,b,c,d,e,f=map(float,input().split(" "))
z=a*e-b*d
if(z!=0):
x=(c*e-b*f)/z
y=(a*f-c*d)/z
print("{:.3f} {:.3f}".format(x+0,y+0))
except:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,294 |
s845496598 | p00004 | u766477342 | 1456659258 | Python | Python3 | py | Accepted | 30 | 7852 | 588 | import math
def saidai(x, y):
x, y = math.fabs(x), math.fabs(y)
y, x = max(x, y), min(x, y)
if x == 0:
return y
return saidai(x, y % x)
def saisyo(x, y):
spam = saidai(x, y)
return spam * (x / spam) * (y / spam)
# a,b,c,d,e,f = list(map(int,'1 2 3 4 5 6'.split()))
try:
while 1:
a,b,c,d,e,f = list(map(int,input().split()))
s = saidai(a, d)
k1 = d / s * -1
k2 = a / s
y = (k1*c + k2 * f) / (k1 * b + k2 * e)
x = (c - b*y) / a
print("{:.3f} {:.3f}".format(x, y))
except Exception:
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,295 |
s831686831 | p00004 | u766477342 | 1456659343 | Python | Python3 | py | Accepted | 20 | 7700 | 440 | import math
def gcd(x, y):
x, y = math.fabs(x), math.fabs(y)
y, x = max(x, y), min(x, y)
if x == 0:
return y
return gcd(x, y % x)
try:
while 1:
a,b,c,d,e,f = list(map(int,input().split()))
s = gcd(a, d)
k1 = d / s * -1
k2 = a / s
y = (k1*c + k2 * f) / (k1 * b + k2 * e)
x = (c - b*y) / a
print("{:.3f} {:.3f}".format(x, y))
except Exception:
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,296 |
s412618871 | p00004 | u766477342 | 1456660680 | Python | Python3 | py | Accepted | 50 | 7532 | 218 | try:
while 1:
a,b,c,d,e,f = list(map(int,input().split()))
y = (c * d - f * a) / (d * b - a * e)
x = (c - b * y) / a
print("{:.3f} {:.3f}".format(x, y))
except Exception:
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,297 |
s371595700 | p00004 | u075836834 | 1457980010 | Python | Python3 | py | Accepted | 20 | 7624 | 242 | while True:
try:
l=list(map(int, input().split()))
x=(l[1]*l[5]-l[2]*l[4])/(l[1]*l[3]-l[0]*l[4])
y=(l[2]-l[0]*x)/l[1]
if x == 0: x = 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,298 |
s117391639 | p00004 | u148101999 | 1458269450 | Python | Python | py | Accepted | 10 | 6280 | 279 | import sys
out = []
for line in sys.stdin.readlines():
List = map(float, line.strip().split())
[a, b, c, d, e, f] = List
x = (b*f-c*e)/(b*d-a*e)
y = (a*f-c*d)/(a*e-b*d)
out.append("%.3f %.3f" % (x+0, y+0))
for i in xrange(len(out)):
print out[i] | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,299 |
s021775401 | p00004 | u915343634 | 1458318045 | Python | Python3 | py | Accepted | 20 | 7348 | 251 | while(True):
try:
a,b,c,d,e,f = map(float, input().split(" "))
z = a*e - b*d
if(z!=0):
x = (c*e - b*f)/z
y = (a*f - c*d)/z
print("{:.3f} {:.3f}".format(x+0,y+0))
except:
break | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,300 |
s249629615 | p00004 | u130979865 | 1459854705 | Python | Python | py | Accepted | 10 | 6408 | 182 | # -*- coding: utf-8 -*-
import sys
for line in sys.stdin:
a, b, c, d, e, f = map(float, line.split())
print "%.3f %.3f" %(round(b*f-c*e)/(b*d-a*e)+0, (c*d-a*f)/(b*d-a*e)+0) | p00004 |
<H1>Simultaneous Equation</H1>
<p>
Write a program which solve a simultaneous equation:<br>
<br>
<var> ax + by = c</var><br>
<var> dx + ey = f</var><br>
<br>
The program should print <var>x</var> and <var>y</var> for given <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var> and <var>f</var> (-1,000 ≤ <var>a, b, c, d, e, f</var> ≤ 1,000). You can suppose that given equation has a unique solution.
</p>
<H2>Input</H2>
<p>
The input consists of several data sets, 1 line for each data set. In a data set, there will be <var>a, b, c, d, e, f</var> separated by a single space. The input terminates with EOF.
</p>
<H2>Output</H2>
<p>
For each data set, print <var>x</var> and <var>y</var> separated by a single space. Print the solution to three places of decimals. Round off the solution to three decimal places.
</p>
<H2>Sample Input 1</H2>
<pre>
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
</pre>
<H2>Output for the Sample Input 1</H2>
<pre>
-1.000 2.000
1.000 4.000
</pre>
<H2>Sample Input 2</H2>
<pre>
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
</pre>
<H2>Output for the Sample Input 2</H2>
<pre>
0.000 3.000
0.000 3.000
</pre>
| 1 2 3 4 5 6
2 -1 -2 -1 -1 -5
| -1.000 2.000
1.000 4.000
| 3,301 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.