QOJ.ac

QOJ

حد الوقت: 2.0 s حد الذاكرة: 512 MB مجموع النقاط: 100 قابلة للهجوم ✓

#16789. Accurate Movement

الإحصائيات

阿米莉亚(Amelia)正在学习建模。她对带有移动部件的模型很感兴趣。

作为她的第一个任务,她制作了一个大小为 $2 \times n$ 的矩形盒子,其中包含两条平行的轨道,每条轨道上有一个矩形滑块。短滑块的大小为 $1 \times a$,长滑块的大小为 $1 \times b$。长滑块的两端各有一个挡板,而短滑块必须始终位于这两个挡板之间。

滑块可以沿轨道移动,每次只能移动一个滑块,前提是短滑块必须始终保持在挡板之间。因此,在每次移动中,阿米莉亚选择其中一个滑块并移动它,而另一个滑块保持不动。

最初,两个滑块都对齐到盒子的同一侧,阿米莉亚希望用尽可能少的移动次数将它们对齐到另一侧。她为了达到目标所需的最少移动次数是多少?

输入格式

输入只有一行,包含三个整数 $a$、$b$ 和 $n$($1 \le a < b \le n \le 10^7$)。

输出格式

输出只有一行,包含一个整数,表示阿米莉亚需要进行的最少移动次数。

样例

输入样例 1

1 3 6

输出样例 1

5

输入样例 2

2 4 9

输出样例 2

7

说明

针对第一个样例的一种可能方案如下图所示。

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.