# 2069：【例2.12 】糖果游戏(2069: [example 2.12] candy game)-其他

## 2069：【例2.12 】糖果游戏(2069: [example 2.12] candy game)

5个小朋友的糖果数。

### 【输入样例】

``8 9 10 11 12``

### 【输出样例】

``   11    7    9   11    6``
``````#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d,e;
cin>>a>>b>>c>>d>>e;
a=a/3;b=b+a;e=e+a;
b=b/3;c=c+b;a=a+b;
c=c/3;d=d+c;b=b+c;
d=d/3;e=e+d;c=c+d;
e=e/3;a=a+e;d=d+e;
cout<<setw(5)<<a<<setw(5)<<b<<setw(5)<<c<<setw(5)<<d<<setw(5)<<e;
}``````
————————

### [Title Description]

In a kindergarten, there are five children numbered 1, 2, 3, 4 and 5. They sit around a round table according to their numbering order. They all have several sweets (keyboard input), and now they play a candy game. Starting from child No. 1, divide his candy into three equal portions (if there is any extra candy, eat it immediately), keep one and give the other two to his two adjacent children. Then children 2, 3, 4 and 5 do the same. Ask how many sweets each child has in hand after a round.

### [input]

The number of sweets for five children.

### [output]

The number of candies for five children after the game. (output by 5-bit width)

### [input example]

``8 9 10 11 12``

### [output example]

``   11    7    9   11    6``
``````#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d,e;
cin>>a>>b>>c>>d>>e;
a=a/3;b=b+a;e=e+a;
b=b/3;c=c+b;a=a+b;
c=c/3;d=d+c;b=b+c;
d=d/3;e=e+d;c=c+d;
e=e/3;a=a+e;d=d+e;
cout<<setw(5)<<a<<setw(5)<<b<<setw(5)<<c<<setw(5)<<d<<setw(5)<<e;
}``````