QOJ.ac

QOJ

Time Limit: 2.0 s Memory Limit: 1024 MB Total points: 100 Hackable ✓

#14403. ธนบัตรสั่งทำ

Statistics

ในอาณาจักร Jagan จนถึงปัจจุบันมีการออกธนบัตรมูลค่า 1 เยนเท่านั้น อย่างไรก็ตาม เนื่องจากปริมาณการหมุนเวียนของธนบัตรที่เพิ่มขึ้น อาณาจักรจึงตัดสินใจปรับปรุงระบบธนบัตรใหม่ทั้งหมด ระบบธนบัตรใหม่จะแทนด้วยลำดับของจำนวนเต็มบวก $x = (x_1, x_2, \dots, x_k)$ ซึ่งหมายความว่าระบบใหม่จะใช้ธนบัตร $k$ ชนิดที่มีมูลค่าหน้าบัตรเป็น $x_1, x_2, \dots, x_k$ เยน คุณสามารถกำหนดจำนวนชนิดของธนบัตร $k$ และมูลค่า $x_1, x_2, \dots, x_k$ ได้ภายใต้ข้อจำกัดต่อไปนี้:

  • $k$ เป็นจำนวนเต็มบวก
  • $1 = x_1 < x_2 < \dots < x_k$
  • $x_{i+1}$ ต้องเป็นพหุคูณของ $x_i$ ($1 \le i \le k - 1$)

ในอาณาจักร Jagan สินค้ามักจะถูกซื้อขายกันที่ราคา $a$, $b$ หรือ $c$ เยน ดังนั้น ความไม่สะดวกของระบบธนบัตรใหม่จึงนิยามได้ดังนี้:

(จำนวนธนบัตรน้อยที่สุดที่ต้องใช้เพื่อแทนมูลค่า $a$ เยน) $+$ (จำนวนธนบัตรน้อยที่สุดที่ต้องใช้เพื่อแทนมูลค่า $b$ เยน) $+$ (จำนวนธนบัตรน้อยที่สุดที่ต้องใช้เพื่อแทนมูลค่า $c$ เยน)

งานของคุณคือการหาค่าที่น้อยที่สุดที่เป็นไปได้ของความไม่สะดวกนี้

ข้อมูลนำเข้า

บรรทัดแรกของข้อมูลนำเข้าประกอบด้วยจำนวนเต็มสามจำนวน: $a$, $b$ และ $c$ ($1 \le a < b < c \le 10^8$)

ข้อมูลส่งออก

พิมพ์จำนวนเต็มหนึ่งจำนวน: ค่าที่น้อยที่สุดที่เป็นไปได้ของความไม่สะดวกสำหรับระบบธนบัตรใหม่

ตัวอย่าง

ข้อมูลนำเข้า 1

6 11 15

ข้อมูลส่งออก 1

6

ข้อมูลนำเข้า 2

99999959 99999971 99999989

ข้อมูลส่งออก 2

11

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.