Back
Close

Equation solver

Statement

 Goal

You must find the value of x in an equation of the type ax + b = y.
If x is a decimal number, this value should be rounded to the nearest integer.
Input
A string S containing an equation of the type: a * x + b = y.
Output
The value of x, rounded to the nearest integer.
Constraints
0 < a < 2^60
0 ≤ b, y < 2^60
a, b, y are integers
Example
Input
2 * x + 2 = 8
Output
3

Game modes
Fastest

Test cases
Example case Test
Input
2 * x + 2 = 8
Output
3

Normal case Validator
Input
8 * x + 20 = 84
Output
8

Rounded value Test
Input
14 * x + 98 = 1503
Output
100

Negative value Validator
Input
4 * x + 28 = 20
Output
-2

Very high result Test
Input
65 * x + 9461648951489465 = 9865324698651254
Output
6210396110181

Big negative result Validator
Input
5 * x + 98654 = 9534
Output
-17824

Very big negative result Test
Input
50 * x + 986517858651498653 = 5
Output
-19730357173029972

Big values Validator
Input
9484584549658451 * x + 412545155146515451 = 6521562165
Output
-43

Solution language

Solution

Stub generator input