## Another Contest 5 Problem 3 - Cutting Cheese Costs

View as PDF

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 256M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Tudor is buying blocks of cheese. Each block of cheese has a regular price and a discounted price.

Tudor has coupons that allow him to buy a block of cheese for the discounted price instead of the regular price. Each coupon can be used for exactly one block of cheese.

Given that Tudor wants to buy all blocks of cheese, compute the minimum amount of money he must spend.

#### Input Specification

The first line contains two space separated integers, and .

The next lines each contain two space separated integers, and representing the regular price and discounted price of block , respectively.

#### Output Specification

Output the minimum amount of money Tudor must spend.

#### Sample Input

2 1
100 0
10 10

#### Sample Output

10

• commented on July 24, 2020, 4:59 p.m. edited

This has nothing to do with cutting cheese. What. I mean, I know it's a block of cheese which you can cut, but, like...

• commented on July 24, 2020, 7:00 p.m.

It is not the cheese that is being cut, but the price of said cheese.

• commented on Oct. 30, 2020, 1:11 p.m.

ohhhh that makes more sense

• commented on Oct. 20, 2019, 10:19 p.m. edited

Can anyone help me with WA (Presentation Error, check your whitespace)?

I literally just output the answer, there is no whitespace...

• commented on Oct. 21, 2019, 12:27 a.m.

You should place a \n character at the end of your output.