P1022 [NOIP 2000 Junior] Improvement of the Calculator
Background
NCL 是一家专门从事计算器改良与升级的实验室,最近该实验室收到了某公司所委托的一个任务:需要在该公司某型号的计算器上加上解一元一次方程的功能。实验室将这个任务交给了一个刚进入的新手 ZL 先生。
Description
To accomplish this task well, Mr. ZL first studied some examples of linear equations in one variable:
- $4+3x=8$.
- $6a-5+1=2-2a$.
- $-5+12y=0$.
Mr. ZL was told by his supervisor that a linear equation in one variable entered into the calculator contains only integers, lowercase letters, and the three mathematical symbols `+`, `-`, `=` (of course, the symbol `-` can be either a subtraction sign or a unary minus). The equation has no parentheses and no division operator. The letters in the equation denote the unknown.
You may assume that the correctness of the entered equation is verified by another programmer; in other words, every entered linear equation in one variable is valid and has a unique real solution.
Input Format
A linear equation in one variable.
Output Format
The solution of the equation (rounded to three decimal places).
Explanation/Hint
Translated by ChatGPT 5