QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22348. קניית חציר

Statistics

האספקה של Farmer John הולכת ואוזלת, והוא צריך לקנות $H$ $(1 \le H \le 50,000)$ פאונד חציר לפרות שלו.

הוא מכיר $N$ $(1 \le N \le 100)$ ספקי חציר, שמוספרו לשם הנוחות $1,\ldots,N$. ספק $i$ מוכר חבילות המכילות $P_{i}$ $(1 \le P_{i} \le 5,000)$ פאונד חציר במחיר $C_{i}$ $(1 \le C_{i} \le 5,000)$ דולרים. לכל ספק יש מספר בלתי מוגבל של חבילות זמינות, ויש לקנות חבילות שלמות.

עזרו ל־FJ למצוא את העלות המזערית הדרושה לקניית לפחות $H$ פאונד חציר.

קלט

  • שורה 1: שני מספרים שלמים $N$ ו־$H$, מופרדים ברווח.
  • שורות $2,\ldots,N+1$: שורה $i+1$ מכילה שני מספרים שלמים $P_{i}$ ו־$C_{i}$, מופרדים ברווח.

פלט

  • שורה 1: מספר שלם אחד המייצג את העלות המזערית שעל FJ לשלם כדי להשיג לפחות $H$ פאונד חציר.

דוגמאות

קלט 1

2 15
3 2
5 3

פלט 1

9

הערה

FJ יכול לקנות שלוש חבילות מהספק השני בעלות כוללת של 9.

מחבר הבעיה: Neal Wu, 2007

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.