jh05013   3년 전

"less than 200 characters"라고 해 놓고 실제로는 a, b, c가 10^9 이하인 것만 들어옵니다. 무슨 생각으로 200 characters라고 한 걸까요... 그리고 테스트케이스가 최대 1,000개라고 해놓고 실제로는 15개밖에 안 되고, 출력도 반올림이 아니라 버림을 해야 하는 굉장한 문제입니다.

(과연 이 문제에도 지옥의 Decimal을 요구하는 데이터가 존재할까요?)

===

You have been asked to write a program that can solve a simple linear equation.

입력

The first line of input contains a single integer P, (1 ≤ P ≤ 100), which is the number of data sets that follow. Each data set consists of a single line containing one simple linear equation. Each equation will be in the form of ax, followed by a single space, followed by a sign “+”, followed by b, followed by a single space, followed by a sign “=”, followed by a single space, followed by c.

ax + b = c

where x is the variable, and a, b, c are non-negative integers (a, b, c ≤ 109).

출력

For each data set, generate two lines of output. The first line will contain “Equation n” where n is the number of the data set. The second line will contain the following answer:

  • If the equation has no solution, print "No solution.".
  • If the equation has infinitely many solutions, print "More than one solution.".
  • If the equation has exactly one solution, print "x = solution" where solution is replaced by the appropriate real number, truncated to six digits after the decimal point.

Print a blank line after each data set case.

startlink   3년 전

수정했습니다.

댓글을 작성하려면 로그인해야 합니다.