問題一覧 > 通常問題

No.1992 Tendon Walk

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 267
作問者 : MasKoaTS / テスター : Kanten4205 👑 potato167
お気に入りにしたユーザー ProblemId : 7712 / 自分の提出
問題文最終更新日: 2024-11-28 20:08:03
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
yukicoder contest 350 (順位表) の他の問題:

Problem Statement

Currently, Koa-san is stopped at the point with coordinate $0$ on a number line.

From now on, Koa-san will perform the following actions A and B in the order "A → A → B → B → A → B → B" as $1$ set, and will perform $100$ sets in a row.

  • Action A : Move $2$ in the positive direction of the number line, then stop at the destination point.

  • Action B : Move $1$ in the negative direction of the number line, then stop at the destination point.

Find the distance traveled by Koa-san until stopping for the first time at the point with coordinate $X$ on the number line.

Here, during each action, Koa-san never stops while moving along the number line.

Constraints

  • $2 \leq X \leq 10$

  • $X$ is an integer

Input

The input is given in the following format.

$X$
  • The $1$st line contains $X$.

Output

Print the answer on $1$ line, followed by a newline.

Sample

Sample 1
Input
6
Output
14

Id7712_statement_picture_01

By performing each action, Koa-san moves and stops at coordinates
$0 \to 2 \to 4 \to 3 \to 2 \to 4 \to 3 \to 2 \to 4 \to 6 \to \cdots$
in this order.

Therefore, the distance traveled until stopping for the first time at the point with coordinate $6$ is

$|2| + |2| + |-1| + |-1| + |2| + |-1| + |-1| + |2| + |2| = 14$

.

Sample 2
Input
3
Output
5

Id7712_statement_picture_02

By performing each action, Koa-san moves and stops at coordinates $0 \to 2 \to 4 \to 3 \to \cdots$ in this order.

Note that when performing action A for the $2$nd time, Koa-san passes through the point with coordinate $3$ but does not stop there.

Sample 3
Input
10
Output
34

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。