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

24770번 - Carousel Rides 다국어

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

문제

Carl likes to ride the carousel. Carousel operators often offer discounts for buying multiple rides. He wonders which of the discounts provides the best value.

Write a program to help him.

입력

The input will contain multiple test cases. A test case starts with a line containing two numbers n (1 ≤ n ≤ 10) and m (1 ≤ m ≤ 20). Carl will not take advantage of offers that require him to buy more than m tickets. Following this are n lines, each with numbers a and b which each represent an offer to buy a tickets for $b.

The input will be terminated by a line containing the characters 0 0.

출력

For each test case, print Buy a tickets for $b for the best offer that matches his requirements. If there are multiple best offers, print the one which buys more tickets. If there is no suitable offer, print No suitable tickets offered.

제한

예제 입력 1

3 5
1 3
3 5
4 7
3 2
3 5
1 3
4 7
3 2
3 6
1 2
2 4
1 3
4 10
0 0

예제 출력 1

Buy 3 tickets for 5ドル
Buy 1 tickets for 3ドル
Buy 2 tickets for 4ドル
No suitable tickets offered

힌트

출처

School > Virginia Tech High School Programming Contest > 2014 Virginia Tech High School Programming Contest F번

  • 문제를 만든 사람: Godmar Back
(追記) (追記ここまで)

출처

대학교 대회

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

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