#MTHA0000015. Phân phối theo vòng (Circular Distribution)
Phân phối theo vòng (Circular Distribution)
Circular Distribution
Version: Phuoc Hung OJ Extended
Problem Statement
There are boxes arranged in a circle and numbered from to . The first item is placed in box ; each next item goes to the next box, wrapping after box . Given items, determine the box receiving the -th item and the number of complete rounds finished before placing it. A complete round consists of consecutive items, one per box.
Input
One line contains three positive integers , , and .
Output
Print two integers: the box receiving the -th item and the number of complete rounds finished before placing it.
Subtasks
- Subtask 1 (30 points):
- .
- .
- Subtask 2 (70 points):
- .
- .
Examples
Example 1
Input
5 3 1
Output
3 0
Explanation
The first item goes directly to box . No item has been placed before it, so zero complete rounds have finished.
Example 2
Input
5 3 8
Output
5 1
Explanation
The first eight destinations are . Before item , seven items have been placed, giving complete round.
Example 3
Input
10 10 21
Output
10 2
Explanation
Before item , twenty items have been placed, giving complete rounds. After twenty shifts, the position returns to box .