Back
Close

Equations

Statement

 Goal

Solve for x in equation.
Input
Line 1: Equation with x
Output
Line 1: The value of x.
Constraints
The equation is of the form number operator number = number operator number with exactly one number replaced by x
-2^31 ≤ number ≤ 2^31-1
operator can be +, -, *, or /
all numbers including x are integers
-2^31 ≤ x ≤ 2^31-1
Example
Input
x+2=5+10
Output
13

Game modes
Fastest, Shortest, Reverse

Test cases
Test 1 Test
Input
x+2=5+10
Output
13

Validator 1 Validator
Input
x+4=10+10
Output
16

Test 2 Test
Input
x-5=4-3
Output
6

Validator 2 Validator
Input
x-8=11-4
Output
15

Test 3 Test
Input
10/x=100/10
Output
1

Validator 3 Validator
Input
800/x=100/10
Output
80

Test 4 Test
Input
x*3=10+5
Output
5

Validator 4 Validator
Input
x*5=10+10
Output
4

Test 5 Test
Input
5000*x=10000/2
Output
1

Validator 5 Validator
Input
324235000*x=3242350000/10
Output
1

Solution language

Solution

Stub generator input