← All problemsSign in

Playing with Toys

CodeChefRating 206Open on judge ↗

Chef got $N$ toys for his birthday. Everyday, if he has at least one toy with him, he plays with one specific toy for that day. Unfortunately, Chef is very careless, and will inevitably break that toy by the end of the day. When he does break it, he does not play with a new toy but just waits for the next day. After $M$ days, how many toys will Chef be left with? ### Input - The first and only

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