QOJ.ac

QOJ

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

#22773. McNuggets מבשר בקר

Statistics

הפרות של Farmer Brown זועמות לאחר ששמעו ש־McDonalds שוקלת להציג מוצר חדש: McNuggets מבשר בקר. הן מנסות למצוא כל דרך אפשרית להציג את המוצר באור שלילי.

אחת האסטרטגיות שלהן היא ״אריזה נחותה״. ״תראו״, אומרות הפרות, ״אם McNuggets מבשר בקר באים בקופסאות של $3$, $6$ ו־$10$, אי אפשר לספק לקוח שרוצה $1,2,4,5,7,8,11,14,17$ McNuggets. אריזה גרועה, מוצר גרוע״.

עזרו לפרות. בהינתן $N$ (מספר אפשרויות האריזה, $1 \le N \le 10$), וקבוצה של $N$ מספרים שלמים חיוביים ($1 \le i \le 256$) המייצגים את מספר הנאגטס באריזות השונות, הדפיסו את המספר הגדול ביותר שאי אפשר לקנות באמצעות הגדלים הנתונים. הדפיסו $0$ אם כל הכמויות אפשריות או אם אין חסם למספר הבלתי אפשרי הגדול ביותר.

המספר הבלתי אפשרי הגדול ביותר, אם הוא קיים, אינו עולה על $2,000,000,000$.

קלט

  • שורה 1: $N$, מספר אפשרויות האריזה.

  • שורות $2..N+1$: מספר הנאגטס בסוג אחד של קופסה.

פלט

קובץ הפלט צריך להכיל שורה אחת עם מספר שלם אחד, המספר הגדול ביותר שאי אפשר לייצג, או $0$ אם כל הרכישות אפשריות או אם אין חסם למספר הבלתי אפשרי הגדול ביותר.

דוגמאות

קלט 1

3
3
6
10

פלט 1

17

מחבר הבעיה: Hubert Chen, 1998

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.