시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 30 5 3 10.714%

문제

x와 y에 관한 연립 일차 방정식이 주어졌을 때, 두 방정식을 푸는 프로그램을 작성하시오.

입력

첫째 줄에 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스는 두 개의 방정식으로 이루어져 있고 한 줄에 하나씩 주어지며, 빈 줄로 케이스를 구분한다.

방정식은 두 개 또는 그 이상의 항이 +, -, =로 구분되어 있다. 항은 정수나 변수(x, y)이고, 변수 앞에는 마이너스 부호나 계수가 붙어있을 수도 있다. 방정식에 = 기호는 한 번만 등장한다. 모든 연산자는 공백으로 둘러쌓여 있고, 항은 공백을 포함하지 않는다.

출력

각 테스트 케이스에 대해서, x와 y값을 순서대로 한 줄에 하나씩 기약분수 형태로 출력한다. 만약, 해가 하나가 아닌 경우에는 don't know를 출력한다. 각 케이스 사이에는 빈 줄을 출력한다. 

예제 입력 1

7
2x + 3y = x
5 = x + y + 3

2x + 3y = 0
10x = -15y

2x + 3y = 0
10x = -15y + 1

x = 1
3x = 6y

2x = 3x + -x + y
x + y = x + y

2x = -3
-2y = 3

1 = 2
x = 3

예제 출력 1

3
-1

don't know
don't know

don't know
don't know

1
1/2

don't know
0

-3/2
-3/2

don't know
don't know
W3sicHJvYmxlbV9pZCI6IjQzNDEiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM1ZjBcdWI5YmQgXHViYzI5XHVjODE1XHVjMmRkIiwiZGVzY3JpcHRpb24iOiI8cD5cclxuXHR4XHVjNjQwIHlcdWM1ZDAgXHVhZDAwXHVkNTVjIFx1YzVmMFx1YjliZCBcdWM3N2NcdWNjMjggXHViYzI5XHVjODE1XHVjMmRkXHVjNzc0IFx1YzhmY1x1YzViNFx1Yzg0Y1x1Yzc0NCBcdWI1NGMsIFx1YjQ1MCBcdWJjMjlcdWM4MTVcdWMyZGRcdWM3NDQgXHVkNDc4XHViMjk0IFx1ZDUwNFx1Yjg1Y1x1YWRmO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