CF Little Artem andPresents 分糖果的小问题
来源:互联网 发布:伊甸园ydy论坛广州域名 编辑:程序博客网 时间:2024/05/29 02:46
Little Artem andPresents
Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u
Submit Status
Description
LittleArtem got n stones on hisbirthday and now wants to give some of them to Masha. He knows that Masha caresmore about the fact of receiving the present, rather than the value of thatpresent, 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 samenumber of stones twice in a row. For example, he can give her3 stones,then 1 stone, then again 3 stones,but he can't give her 3 stonesand then again 3 stones rightafter that.
Howmany times can Artem give presents to Masha?
Input
Theonly line of the input contains a single integer n (1 ≤ n ≤ 109) —number of stones Artem received on his birthday.
Output
Printthe maximum possible number of times Artem can give presents to Masha.
Sample Input
Input
1
Output
1
Input
2
Output
1
Input
3
Output
2
Input
4
Output
3
题意:你有 n 个糖果,想要送给自己钟意的人,两次送的个数不能够相同,问有多少种送法。
解法:想要玩的时间最长,就 1,2,1,2,1,2,1,2……的送。
/*=============================AC情况===============================*//*题目网址: *//*时间: *//*心得: 还以为有递推公式,看到 n 的范围。。。。 */#include<stdio.h>#include<stdlib.h>#include<string.h>#define G 100int main() {int n,ans;while(scanf("%d",&n)!=EOF) {ans=2*(n/3);if(n%3!=0) {ans++;}printf("%d\n",ans);}return 0;}/*********************************测试数据***********************************************************************************************************/
- CF Little Artem andPresents 分糖果的小问题
- CF Round #348 Div. 2 A. Little Artem and Present B. Little Artem and Grasshopper C. Little Artem and
- CF 668C(Little Artem and Random Variable-概率)
- CF 668C Little Artem and Random Variable
- CodeForces 669B Little Artem and Grasshopper(可怜的小蚂蚱,等待AC)
- 分糖果问题
- 分糖果问题1
- 分糖果 问题
- 分糖果问题
- 分糖果问题--蓝桥杯
- 问题 1431: 分糖果
- Little Artem and Grasshopper
- hunnu11543:小明的烦恼——分糖果
- hunnu--11543--小明的烦恼——分糖果
- 站队问题、分糖果问题
- OJ-Candy 分糖果问题
- 分糖果问题(java)
- 其他题目---分糖果问题
- 禁用COOKIE后SESSION还能用吗
- Oracle 12c创建用户是出现“ORA-65096: invalid common user or role name”的错误 - CalvinR
- 构造器
- gets(),getchar(),fgets()
- Github 在mac下的连接和上传
- CF Little Artem andPresents 分糖果的小问题
- Android AlertDialog,PopupWindow,DatePickerDialog,ProgressDialog的详细介绍
- tomcat多实例部署
- Strut2.0 底层分析
- 巴蜀1471 魔兽争霸
- PHP对表单提交特殊字符的过滤和处理
- jetty多实例部署
- 当返回不了json对象的时候
- Android进阶专题二:NDK环境搭建