Logo
(追記) (追記ここまで)

27107번 - Garage Sailing 다국어채점 준비 중

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB0000.000%

문제

The cows have boarded their station wagon to head to town for their annual shopping trip at garage sales. They have peculiar tastes and shop only for artistic objects that are pretty much the same size.

While peculiar, their tastes are impeccable and they have the uncanny ability to know exactly how much a given object will fetch on the open market. Sometimes, they can sell the objects for a profit.

Given the labeled price and the actual value for a set of objects, calculate the greatest possible profit the cows can make, given that only K of the objects will fit in the station wagon. Of course, the cows can buy only one of each type of object.

입력

  • Line 1: two integers:
    • K, 1 ≤ K ≤ 100, the number of objects that will fit in the station wagon
    • N, 1 ≤ N ≤ 100, the number of objects at the sale
  • Lines 2..N+1: two space-separated integers denoting respectively the price of the object at the garage sale and the price of the object on the open market

출력

A single line containing one integer, the largest possible profit given the constraints.

제한

예제 입력 1

2 5
4 3
5 6
6 9
7 12
8 7

예제 출력 1

8

힌트

출처

Olympiad > USA Computing Olympiad > 1999-2000 Season > USACO Winter 2000 Contest > Orange 4번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /