← All problemsSign in

Christmas Trees

CodeChefRating 300Open on judge ↗

Chef opened a tree-selling business this Christmas. He bought $N$ trees for $A$ rupees, and then sold $M$ trees for $B$ rupees. What was his profit this Christmas? If Chef instead made a loss of $X$ rupees, print $-X$. ### Input - The first and only line of input contains $4$ integers - $N, A, M$ and $B$. ### Output Output Chef's profit this christmas. ### Constraints - $1 \le M \le N \le 10

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start