QOJ.ac

QOJ

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

#22773. McNuggets thịt bò

Statistics

Các con bò của Farmer Brown phẫn nộ khi nghe McDonalds cân nhắc giới thiệu sản phẩm mới: McNuggets thịt bò. Chúng tìm mọi cách có thể để tạo ấn tượng xấu về sản phẩm này.

Một chiến lược chúng theo đuổi là «đóng gói kém». Chúng nói: «Xem này, nếu có hộp $3$, $6$ và $10$ miếng McNuggets thịt bò, bạn không thể đáp ứng khách muốn $1,2,4,5,7,8,11,14,17$ miếng. Đóng gói tệ, sản phẩm tệ».

Hãy giúp các con bò. Cho $N$ (số lựa chọn đóng gói, $1 \le N \le 10$) và tập $N$ số nguyên dương ($1 \le i \le 256$) biểu thị số miếng trong từng loại gói, hãy in số miếng lớn nhất không thể mua bằng các kích thước đã cho. In $0$ nếu mọi số lượng đều mua được hoặc nếu số lượng không thể mua lớn nhất không có giới hạn.

Số lớn nhất không thể mua, nếu tồn tại, không vượt quá $2,000,000,000$.

Dữ liệu vào

  • Dòng 1: $N$, số lựa chọn đóng gói.

  • Các dòng $2..N+1$: số miếng trong một loại hộp.

Dữ liệu ra

Tệp đầu ra phải chứa một dòng với một số nguyên là số miếng lớn nhất không thể biểu diễn, hoặc $0$ nếu mọi số lượng đều mua được hoặc số lớn nhất không thể mua không có giới hạn.

Ví dụ

Dữ liệu vào 1

3
3
6
10

Dữ liệu ra 1

17

Tác giả bài toán: 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.