4326 - 대수: 2 * 2 선형 방정식 풀이

Time Limit: 1s Memory Limit: 128MB

Submissions: 2043 Solved: 624
Description

선형 방정식의 해는 다음 Cramer's rule를 이용해 구할 수 있습니다.  

A linear equation can be solved using Cramer's rule using the following formula:

사용자로부터 a, b, c, d, e, f를 입력받아 x, y를 구하는 프로그램을 작성하세요. 만약 해가 존재하지 않을 경우 "no solution"이라고 출력하세요.

Write a program that prompts the user to enter a, b, c, d, e, and f and displays the result. If ad - bc is 0, report that "no solution"

Input

* Line 1 : 6개의 실수 a, b, c, d, e, f가 순차적으로 공백으로 구분되어 있음

 

Output

* Line 1 : x, y값중 큰 수부터 공백으로 구분해서 출력(1의자리 자리 아래는 버림. 예: 11.713는 11, 11.0은 11, -1.5은 -1 으로 출력)하고 값이 없을 경우 no solution 문자열을 출력

Sample Input
9.0 4.0 3.0 -5.0 -6.0 -21.0
Sample Output
3 -2
Source

JAVA2015 PE3.3