Description
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 her3 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.
Sample Input
1
1
2
1
3
2
4
3
题意:某人有N个糖果,想送给另一个人,他想要送的次数最多,但相邻两次送的糖果数,不能相同,问最多送几次。
水。。。。。
#include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int main() { int n,num,k; while(scanf("%d",&n)!=EOF) { num=n/3*2; if(n%3) { num++; } printf("%d\n",num); } return 0; }