QOJ.ac

QOJ

時間限制: 1.0 s 記憶體限制: 32 MB 總分: 30

#17012. 糖

统计

Mirko 在一家糖厂工作,负责送货。他刚刚收到一份订单:需要将恰好 $N$ 公斤的糖送到亚得里亚海海岸的一家糖果店。Mirko 可以使用两种包装袋,一种装 $3$ 公斤糖,另一种装 $5$ 公斤糖。

Mirko 希望尽可能少地使用包装袋。例如,如果他需要送 $18$ 公斤糖,他可以使用 $6$ 个 $3$ 公斤的包装袋。但更好的方案是使用 $3$ 个 $5$ 公斤的包装袋和 $1$ 个 $3$ 公斤的包装袋,总共只需 $4$ 个包装袋。

请帮助 Mirko 找到运输恰好 $N$ 公斤糖所需的最少包装袋数量。

输入格式

输入的唯一一行包含一个整数 $N$($3 \le N \le 5000$)。

输出格式

输出的唯一一行应包含 Mirko 必须使用的最少包装袋数量。如果无法恰好配送 $N$ 公斤糖,则输出 -1

样例

输入样例 1

4

输出样例 1

-1

输入样例 2

9

输出样例 2

3

输入样例 3

18

输出样例 3

4

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.