#C1757. Maximize Ticket Distribution
Maximize Ticket Distribution
Maximize Ticket Distribution
You are given N ticket categories. For each category, there are two numbers: the number of tickets available and the number of prizes available. A category can distribute at most \(\min(\text{tickets}, \text{prizes})\) tickets. Your task is to compute the maximum number of tickets that can be distributed across all categories.
Note: The value \(\min(a, b)\) represents the minimum of \(a\) and \(b\).
inputFormat
The input is read from stdin
and has the following format:
- The first line contains a single integer \(N\) which represents the number of ticket categories.
- Each of the following \(N\) lines contains two space-separated integers. The first integer represents the number of tickets available for the category, and the second integer represents the number of prizes available.
outputFormat
Output a single integer to stdout
, which is the maximum number of tickets that can be distributed across all categories.
3
10 2
15 3
20 5
10