【CodeForces】669A - Little Artem and Presents(找规律)
来源:互联网 发布:黑帽seo技术到哪里学 编辑:程序博客网 时间:2024/05/17 01:09
题目链接:点击打开题目
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?
The only line of the input contains a single integer n (1 ≤ n ≤ 109) — number of stones Artem received on his birthday.
Print the maximum possible number of times Artem can give presents to Masha.
1
1
2
1
3
2
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.
写一部分规律就找出来了。
代码如下:
#include <cstdio>int main(){int n;scanf ("%d",&n);if (n % 3 == 0)printf ("%d\n",n/3*2);elseprintf ("%d\n",n/3*2+1);return 0;}
- 【CodeForces】669A - Little Artem and Presents(找规律)
- 【codeforce】-#669A-Little Artem and Presents(数学,找规律)
- CodeForces 669A Little Artem and Presents
- CodeForces 669A Little Artem and Presents
- 【CodeForces】669A - Little Artem and Presents
- 【CodeForces】[669A]Little Artem and Presents
- CodeForces 669A Little Artem and Presents
- codeforces 669A Little Artem and Presents
- Codeforces 669A Little Artem and Presents(数量不同送礼物)
- A. Little Artem and Presents
- Codeforces Round #348 (div 2) A. Little Artem and Presents
- 13周练J - Little Artem and Presents【规律】
- Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition)-A. Little Artem and Presents(模拟)
- CodeForces 669ALittle Artem and Presents
- CodeForces 641 A.Little Artem and Grasshopper(水~)
- CodeForces 668A Little Artem and Matrix
- codeforces#348-D - Little Artem and Dance-规律-模拟
- Codeforces #669 Div2 C. Little Artem and Matrix(模拟)
- LinearGradient
- 超越分析国内典型的服务器架构
- JQuery快速学二(DOM操作)
- 引用
- 【android】:android里面的intent的action详解
- 【CodeForces】669A - Little Artem and Presents(找规律)
- 【SVN Working copy is too old (format 10, created by Subversion 1.6)】解决方案
- Java反射一 类
- xcode自定义编写插件----改变c++/c注释风格
- JQuery快速学三之一(事件)
- ajax异步处理echarts图形
- iOS开发之NSUserDefault详解
- 超越整理的nginx配置文件详细说明
- codeforces Round #354 (Div. 2) A