Candy Rounds
N children sit in a circle; child i asks for i candies each time it is their turn (turns go 1, 2, ..., N, 1, 2, ...). You start with C candies and serve children in order until you cannot fully serve the next child. Print how many servings you made and how many candies remain.
Input: one line with two integers N and C.
Output: two integers: the number of full servings, and the leftover candies.
Constraints:
- 1 ≤ N ≤ 1000
- 0 ≤ C ≤ 109
Sample Tests
Input 1
3 15
Output 1
8 0
Input 2
2 3
Output 2
2 0
Discussion (opens after you solve — no spoilers before)
No comments yet.