問題一覧 > 通常問題

No.3083 One Two

レベル : / AI推定難易度 : 96 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 171
作問者 : yuusaan / テスター : kazuppa 👑 amentorimaru
お気に入りにしたユーザー ProblemId : 11403 / 自分の提出
問題文最終更新日: 2025-04-04 10:21:59
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. Back to the original
yukicoder contest 463 (順位表) の他の問題:

Story

Yu~-san receives $1$ kyanto as pocket money for cleaning the bath. (Kyanto is a unit of currency.)

Similarly, he receives $2$ kyanto as pocket money for doing the laundry.

Yu~-san's parents have ordered him to do one or the other every day. He is also saving up his pocket money to buy a VR headset.

However, due to his limited stamina, Yu~-san can only do one of the two in a single day. So he started to wonder how many days it will take, at minimum, until he can afford the VR headset.

"Wait, it only costs $N$ kyanto? What's going on with prices? ($N\le 100$)"

Problem Statement

You are given a non-negative integer $N$. Separately, there is a non-negative integer $x$. Initially, $x=0$.

You may perform the following operations any number of times, possibly $0$ times.

  • Add $1$ to $x$.
  • Add $2$ to $x$.

Find the minimum number of operations required to make the value of $x$ equal to $N$.

Under the constraints, it is guaranteed that the value of $x$ can be made exactly equal to $N$ with a finite number of operations.

Input

$N$

Constraints

  • $0\le N\le 100$
  • $N$ is an integer.

Output

Print the answer on a single line, followed by a newline.

Sample

Sample 1
Input
5
Output
3

For example, $x$ can be made exactly equal to $N$ by performing the operations as follows.

  • Add $2$ to $x$. Now $x=2$.
  • Add $1$ to $x$. Now $x=3$.
  • Add $2$ to $x$. Now $x=5$.

In this case, the number of operations is $3$. It is impossible to make $x$ exactly equal to $N$ with fewer than $3$ operations, so print $3$.

Sample 2
Input
0
Output
0

It may be the case that no operations are needed at all.

Sample 3
Input
23
Output
12

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