Թաքցված խնդիր
|Այս խնդիրը թաքցված է խմբագրական խրհրդի անդամի կողմից քանի որ կամ այն ոչ ճիշտ լեզվով է գրված,|կամ թեստային տվյալներն են սխալ, կամ խնդրի ձևակերպումը պարզ չէ։|

ACM0301 - LINEAR EQUATION

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

Input.

   The first line of input contains a single integer P, (1 ≤ P ≤ 1000), which is the number of data sets that follow. Each data set consists of a single line containing one simple linear equation. All equations are strings of less than 200 characters. 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 (real number) and a, b, c are positive integers.

Output.

   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 (printed to six decimals).

   Print a blank line after each data set case.  

Sample test.

N

stdin

stdout

1

5
2x + 3 = 4
124x + 20 = 160
123456x + 7 = 2000
0x + 2 = 3
0x + 2 = 2

Equation 1
x = 0.500000

Equation 2
x = 1.129032

Equation 3
x = 0.016143
 
Equation 4
No solution.
 
Equation 5
More than one solution.

Ավելացրեց.Հրանտ Հովհաննիսյան
Ամսաթիվ.2016-07-22
Ժամանակի սահմանափակումը.1s
Ծրագրի տեքստի սահմանափակումը.50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Լեզուներ.Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PYPY3 PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE
Աղբյուրը.Beninese Collegiate Programming Contest, 2016

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.