#C8090. Tournament Scheduling

    ID: 52034 Type: Default 1000ms 256MiB

Tournament Scheduling

Tournament Scheduling

You are given an integer n representing the number of participants in a round-robin tournament and an integer k representing the maximum number of matches that can be played concurrently in one day.

In a round-robin tournament, each pair of distinct participants plays exactly one match. Thus, the total number of matches is given by the binomial coefficient \[ T = \binom{n}{2} = \frac{n(n-1)}{2} \]

Your task is to compute the minimum number of days required to complete the tournament if at most k matches are played on any day.

Note: The input is considered invalid if the number of participants is less than 2 or if the number of concurrent matches per day is less than 1. In these cases, your program should raise an appropriate error.

inputFormat

The input consists of two space-separated integers: n and k.

  • n: The number of participants (an integer, must be at least 2).
  • k: The number of matches that can be played concurrently per day (an integer, must be at least 1).

outputFormat

Output a single integer representing the minimum number of days required to complete the tournament.

## sample
4 2
3