시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 128 MB 311 19 9 18.000%

문제

삼차 방정식 Ax3 + Bx2 + Cx + D = 0 의 모든 실수 해를 찾는 프로그램을 작성하시오.

입력으로 주어지는 방정식은 정수 해를 적어도 한 개 갖는다.

A, B, C, D는 -2,000,000보다 크거나 같고, 2,000,000보다 작거나 같은 정수이고, A는 0이 아니다. 모든 해는 -1,000,000보다 크거나 같고, 1,000,000보다 작거나 같다. 주어지는 방정식의 해의 차이는 10-4보다 크다.

입력

첫째 줄에 테스트 케이스의 개수 N (0 < N < 100)이 주어진다. 다음 N개 줄에는 삼차 방정식의 계수 A, B, C, D가 한 줄에 하나씩 주어진다.

출력

입력으로 주어진 방정식마다 모든 실수 해를 오름차순으로 출력한다. 해의 절대/상대 오차는 10-4까지 허용한다. 중근이 존재하는 경우에는 한 번만 출력한다.

예제 입력 1

2
2 -7 7 -2
2 0 0 0

예제 출력 1

0.5000 1.0000 2.0000
0.0000
W3sicHJvYmxlbV9pZCI6Ijk3MzUiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWMwYmNcdWNjMjggXHViYzI5XHVjODE1XHVjMmRkIFx1ZDQ4MFx1YWUzMCIsImRlc2NyaXB0aW9uIjoiPHA+XHVjMGJjXHVjYzI4IFx1YmMyOVx1YzgxNVx1YzJkZCBBeDxzdXA+MzxcL3N1cD4gKyBCeDxzdXA+MjxcL3N1cD4gKyBDeCArIEQgPSAwJm5ic3A7XHVjNzU4IFx1YmFhOFx1YjRlMCBcdWMyZTRcdWMyMTggXHVkNTc0XHViOTdjIFx1Y2MzZVx1YjI5NCBcdWQ1MDRcdWI4NWNcdWFkZjhcdWI3YThcdWM3NDQgXHVjNzkxXHVjMTMxXHVkNTU4XHVjMmRjXHVjNjI0LjxcL3A+XHJcblxyXG48cD5cdWM3ODVcdWI4MjVcdWM3M2NcdWI4NWMgXHVjOGZjXHVjNWI0XHVjOWMwXHViMjk0IFx1YmMyOVx1Yzg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IgMC48XC9wPlxyXG4iLCJvdXRwdXQiOiI8cD5Gb3IgZWFjaCBpbnB1dCBsaW5lLCBwcmludCBhbGwgZGlzdGluY3QgcmVhbCBzb2x1dGlvbnMgb2YgdGhlIGN1YmljIGVxdWF0aW9uIGluIG9uZSBsaW5lLCBzb3J0ZWQgaW4gaW5jcmVhc2luZyBvcmRlci4gRWFjaCByZWFsIHNvbHV0aW9uIG11c3QgYmUgcm91bmRlZCBvZmYgdG8gdGhlIG5lYXJlc3QgdGVuIHRob3VzYW5kdGggYW5kIG11c3QgYmUgcHJpbnRlZCB3aXRoIGV4YWN0bHkgZm91ciBkaWdpdHMgYWZ0ZXIgdGhlIGRlY2ltYWwgcG9pbnQuIFR3byBvciBtb3JlIGRpc3RpbmN0IHJlYWwgc29sdXRpb25zIG11c3QgYmUgc2VwYXJhdGVkIGJ5IGV4YWN0bHkgb25lIHNwYWNlLjxcL3A+XHJcbiIsImhpbnQiOiIiLCJvcmlnaW5hbCI6IjEiLCJwcm9ibGVtX2xhbmdfY29kZSI6Ilx1YzYwMVx1YzViNCJ9XQ==

출처

ACM-ICPC > Regionals > Asia > Philippines > Philippines Multi-Provincial Programming Contest > Philippines Multi-Provincial Programming Contest 2013 C번