#C7112. Minimum Benches and Last Bench Seating

    ID: 50948 Type: Default 1000ms 256MiB

Minimum Benches and Last Bench Seating

Minimum Benches and Last Bench Seating

You are given a large number of friends n and a bench seating capacity c. The problem is to determine the minimum number of benches required to seat all your friends such that each bench can seat up to c friends. In addition, you need to determine how many friends will be seated on the last bench.

The seating follows these rules:

  • If n is exactly divisible by c, then all benches will be fully occupied and the last bench will have exactly c friends.
  • If n is not exactly divisible by c, then one extra bench is required to seat the remaining friends.

This can be mathematically expressed as follows:

Let \( q = \lfloor n/c \rfloor \) and \( r = n \bmod c \). Then the answer is:

\[ \text{benches} = \begin{cases} q, & \text{if } r = 0 \\ q+1, & \text{if } r \neq 0 \end{cases} \quad \text{and} \quad \text{last bench seating} = \begin{cases} c, & \text{if } r = 0 \\ r, & \text{if } r \neq 0 \end{cases} \]

Your solution needs to handle values of n and c as large as \(10^{18}\), so be mindful of potential performance issues and data type limits in your chosen language.

inputFormat

The input is provided via standard input (stdin) as a single line containing two space-separated integers:

  • n — the total number of friends (\(1 \leq n \leq 10^{18}\)).
  • c — the seating capacity of each bench (\(1 \leq c \leq 10^{18}\)).

outputFormat

The output should be printed via standard output (stdout) as two space-separated integers on a single line:

  • The minimum number of benches required.
  • The number of friends seated on the last bench.
## sample
15 6
3 3