QOJ.ac

QOJ

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

#22503. Trả tiền thừa

Statistics

Bessie tội nghiệp làm ở cửa hàng tiện lợi ngay bên kia biên giới Slobbovia. Tiền xu khác USA, giá trị đổi hàng ngày!

Giúp trả tối ưu cho khách Slobbovia: $C$ xu ($1 \le C \le 1000$) bằng $N$ mệnh giá ($1 \le N \le 10$). Mọi kiểm thử giải được bằng xu cho sẵn.

Có 50, 25, 10, 5, 1, tối ưu ít xu nhất cho 93 xu là $1 \times 50$, $1 \times 25$, $1 \times 10$, $1 \times 5$, $3 \times 1$: tổng 7 xu.

Khó đến đâu? Hai kiểm thử cuối sẽ thách thức.

Dữ liệu vào

Đọc đầu vào chuẩn.

Dòng 1: số nguyên $C$ và $N$ cách nhau bởi dấu cách.

Các dòng $2..N+1$: số nguyên phân biệt mỗi dòng, mệnh giá dùng được.

Dữ liệu ra

Ghi đầu ra chuẩn.

Dòng 1: số nguyên là ít xu nhất tạo $C$ xu.

Ví dụ

Dữ liệu vào 1

93 5
25
50
10
1
5

Dữ liệu ra 1

7

Nguồn: USACO tháng 1 năm 2007, đồng

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.