cswork / OAOpen practice workspace

SofiOA #1

Job Scheduling

Estimated MediumJudge-ready

Topics (AI-labelled)Binary SearchBits & Math

Assign m jobs to n processors, with at least one job on each. The numbers of jobs on adjacent processors differ by at most 1. The given k-th processor is the most efficient; find the maximum number of jobs it can get in a valid assignment.

This site added the standard input/output protocol.

Input

Input n m k, where k is 1-based.

Output

Output the maximum number of jobs the k-th processor can get.

Example 1

Input:

5 11 5

Output:

4

Example 2

Input:

5 11 3

Output:

3

Example 3

Input:

1 9 1

Output:

9

Editorial

Loading solution…