QOJ.ac

QOJ

Süre Sınırı: 2 s Bellek Sınırı: 256 MB Toplam puan: 100

#22503. إعطاء الباقي

İstatistikler

تعمل Bessie المسكينة بمتجر للمستلزمات اليومية بعد الحدود مباشرة في Slobbovia. عملاتهم مختلفة عن USA وتتغير قيمها كل يوم!

ساعدها بإعطاء باقي مثالي لزبائن Slobbovia: $C$ سنتاً ($1 \le C \le 1000$) باستخدام $N$ فئات من العملات ($1 \le N \le 10$). كل الاختبارات قابلة للحل بالعملات المعطاة.

بقيم 50 و25 و10 و5 و1، أقل عدد لباقي 93 سنتاً هو $1 \times 50$ و$1 \times 25$ و$1 \times 10$ و$1 \times 5$ و$3 \times 1$، إجمالي 7 عملات.

كم قد يكون صعباً؟ آخر اختبارين فيهما تحدٍ.

الإدخال

اقرأ الإدخال القياسي.

السطر 1: العددان الصحيحان $C$ و$N$ مفصولان بفراغ.

الأسطر $2..N+1$: عدد صحيح مميز بكل سطر، قيمة عملة متاحة.

الإخراج

اكتب الإخراج القياسي.

السطر 1: عدد صحيح، أقل عدد عملات لتكوين $C$ سنتاً.

أمثلة

الإدخال 1

93 5
25
50
10
1
5

الإخراج 1

7

المصدر: USACO يناير 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.