# How many students solved only problem B?

Question: In a contest of intelligence, three problems A, B and C were posed.
* Among the contestants there were 25 who solved at least one problem each.
* Of all the contestants who did not solve problem A, the number who solved B was twice the number who solved C.
* The number of participants who solved only problem A was one more than the number who solved problem A and at least one other problem.
* Of all students who solved just one problem, half did not solve problem A.
How many students solved only problem B?

6 students solved only problem B
X => Students who solved only problem A
Y => Students who solved only problem B
Z => Students who solved only problem C
P => Students who solved both problem B and problem C

From 4 :
Students who solved only problem A = Students who solved only problem B + Students who solved only problem C

X = Y + Z

From 3 :
Students who solved problem A and at least one other = X - 1

From 2 :
(Y + P) = 2 * (Z + P)
Y + P = 2 * Z + 2 * P
Z = (Y - P) / 2

From 1 and Figure:
X + X - 1 + Y + Z + P = 25
2*X + Y + Z + P = 26
2*(Y + Z) + Y + Z + P = 26 (from 4)
3*Y + 3*Z + P = 26
3*Y + 3* (Y - P) / 2 + P = 26 (from 2)
6*Y + 3*Y - 3*P + 2*P = 52
9*Y - P = 52
Y = (52 + P) / 9
Now, it is obvious that all values are integer. Hence, P must be 2 and Y must be 6.
So 6 students solved only problem B.