#K35302. Maximum Total Discount
Maximum Total Discount
Maximum Total Discount
You are given a list of n items. Each item is represented by its price and discount. A user is allowed to purchase any subset of these items, and the total discount a user can receive is the sum of discounts from the purchased items.
Since discounts are always non‐negative in this problem, the optimal strategy is straightforward: the maximum achievable total discount is simply the sum of the discounts of all items. Formally, if the discount for the i-th item is \(d_i\), then the maximum total discount is given by:
\(\text{Total Discount} = \sum_{i=1}^{n} d_i\)
Your task is to compute and print this total discount. Note that if n is zero, then there are no items and the output should be 0.
inputFormat
The input is read from stdin and is in the following format:
- The first line contains an integer n, the number of items.
- The next n lines each contain two space-separated integers, representing price and discount respectively.
If n equals 0, no additional lines follow.
outputFormat
Output a single integer to stdout which represents the maximum total discount achievable.
## sample4
100 40
200 90
150 50
120 30
210