首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >【CodeForces】669A - Little Artem and Presents(找规律)

【CodeForces】669A - Little Artem and Presents(找规律)

作者头像
FishWang
发布2025-08-26 15:45:31
发布2025-08-26 15:45:31
5800
代码可运行
举报
运行总次数:0
代码可运行

题目链接:点击打开题目

A. Little Artem and Presents

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

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?

Input

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

Output

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

Examples

input

代码语言:javascript
代码运行次数:0
运行
复制
1

output

代码语言:javascript
代码运行次数:0
运行
复制
1

input

代码语言:javascript
代码运行次数:0
运行
复制
2

output

代码语言:javascript
代码运行次数:0
运行
复制
1

input

代码语言:javascript
代码运行次数:0
运行
复制
3

output

代码语言:javascript
代码运行次数:0
运行
复制
2

input

代码语言:javascript
代码运行次数:0
运行
复制
4

output

代码语言:javascript
代码运行次数:0
运行
复制
3

Note

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.

写一部分规律就找出来了。

代码如下:

代码语言:javascript
代码运行次数:0
运行
复制
#include <cstdio>
int main()
{
	int n;
	scanf ("%d",&n);
	if (n % 3 == 0)
		printf ("%d\n",n/3*2);
	else
		printf ("%d\n",n/3*2+1);
	return 0;
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2025-08-26,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档