QOJ.ac

QOJ

时间限制: 2 s 内存限制: 1024 MB

#23949. Walking

统计

Problem Description

JOI is taking a walk on a straight road.

JOI alternates between the following actions in the order Action A → Action B → Action A → …:

  • Action A: Move $3\text{ m}$ forward.
  • Action B: Move $2\text{ m}$ backward.

When he has performed Action A and Action B a total of $X$ times, how many $\text{m}$ forward from the starting position has he moved?

Constraints

  • $1 \le X \le 100$.
  • $X$ is an integer.

Input

The input is given in the following format:
$X$

Output

Output the distance in $\text{m}$ moved forward from the starting position, omitting the unit ($\text{m}$).

Do not output anything other than the answer. (Do not output prompt messages for input, etc.)

For the answer format, you may also refer to the practice problems and their sample solutions.


Sample Input 1

3

Sample Output 1

4
  • Move $3\text{ m}$ forward.
  • Move $2\text{ m}$ backward.
  • Move $3\text{ m}$ forward.

He performs a total of $3$ actions as above, so he has moved $4 (= 3 - 2 + 3)\text{ m}$ forward from the starting position. Therefore, output $4$.


Sample Input 2

6

Sample Output 2

3
  • Move $3\text{ m}$ forward.
  • Move $2\text{ m}$ backward.
  • Move $3\text{ m}$ forward.
  • Move $2\text{ m}$ backward.
  • Move $3\text{ m}$ forward.
  • Move $2\text{ m}$ backward.

He performs a total of $6$ actions as above, so he has moved $3 (= 3 - 2 + 3 - 2 + 3 - 2)\text{ m}$ forward from the starting position. Therefore, output $3$.


Sample Input 3

1

Sample Output 3

3
  • Move $3\text{ m}$ forward.

He performs a total of $1$ action as above, so he has moved $3\text{ m}$ forward from the starting position. Therefore, output $3$.


Sample Input 4

37

Sample Output 4

21

Since he has moved $21\text{ m}$ forward from the starting position, output $21$.


Sample Input 5

100

Sample Output 5

50

Since he has moved $50\text{ m}$ forward from the starting position, output $50$.

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.