CF669A.Little Artem and Presents

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that present, so he wants to give her stones as many times as possible. However, Masha remembers the last present she received, so Artem can't give her the same number of stones twice in a row. For example, he can give her 3 stones, then 1 stone, then again 3 stones, but he can't give her 3 stones and then again 3 stones right after that.

How many times can Artem give presents to Masha?

小 Artem 在生日时收到了 nn 块石头,现在想将其中一些送给 Masha。他知道 Masha 更在意收到礼物这一事实,而非礼物本身的价值,因此他希望尽可能多地送礼物给 Masha。然而,Masha 会记住她上一次收到的礼物数量,因此 Artem 不能连续两次赠送相同数量的石头。例如,他可以先送 3 块石头,再送 1 块石头,然后再送 3 块石头;但他不能先送 3 块石头,紧接着又送 3 块石头。

Artem 最多能送多少次礼物给 Masha?

输入格式

The only line of the input contains a single integer n (1 ≤ n ≤ 109) — number of stones Artem received on his birthday.

输入仅包含一行,一个整数 nn(1 ≤ n ≤ 1091 ≤ n ≤ 10^9)——Artem 生日时收到的石头数量。

输出格式

Print the maximum possible number of times Artem can give presents to Masha.

输出 Artem 最多可以送给 Masha 礼物的次数。

输入输出样例

  • 输入#1

    1

    输出#1

    1
  • 输入#2

    2

    输出#2

    1
  • 输入#3

    3

    输出#3

    2
  • 输入#4

    4

    输出#4

    3

说明/提示

In the first sample, Artem can only give 1 stone to Masha.

In the second sample, Atrem can give Masha 1 or 2 stones, though he can't give her 1 stone two times.

In the third sample, Atrem can first give Masha 2 stones, a then 1 more stone.

In the fourth sample, Atrem can first give Masha 1 stone, then 2 stones, and finally 1 stone again.

在第一个样例中,阿尔乔姆只能给玛莎 1 颗石头。

在第二个样例中,阿尔乔姆可以给玛莎 1 颗或 2 颗石头,但他不能两次都给玛莎 1 颗石头。

在第三个样例中,阿尔乔姆可以先给玛莎 2 颗石头,然后再给 1 颗石头。

在第四个样例中,阿尔乔姆可以先给玛莎 1 颗石头,然后给 2 颗石头,最后再给 1 颗石头。

输入解题思路,AI测评打分。不知道怎么写?

首页