No.3083 One Two
タグ : / 解いたユーザー数 171
作問者 :
kazuppa
👑
amentorimaru
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もしくは右上の雲マークをクリックしてアカウントを作成してください。