SJSU Weekly Practice Problems 3/11

#### Start

2020-03-12 20:15 UTC

## SJSU Weekly Practice Problems 3/11

#### End

2020-03-19 04:15 UTC
The end is near!
Contest is over.
Not yet started.
Contest is starting in -75 days 7:22:42

152:00:00

0:00:00

# Problem ECarousel Rides

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, up to $100$. A test case starts with a line containing two integers $n$ ($1 \le n \le 10$) and $m$ ($1 \le m \le 20$). Carl will not take advantage of offers that require him to buy more than $m$ tickets. Following this are $n$ lines, each with integers $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. ## Output 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.

Sample Input 1 Sample Output 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

Buy 3 tickets for $5 Buy 1 tickets for$3
Buy 2 tickets for \$4
No suitable tickets offered