#include<iostream>
using namespace std;
void print(int s[]);
int judge(int c[]);
int j = 0;
int main()
{
int sweet[10] = { 10,2,8,22,16,4,10,6,14,20 };
int t[10];
cout << "child 1 2 3 4 5 6 7 8 9 10" << endl;
cout << "-----------------------------------------------------" << endl;
cout << "time" << endl;
print(sweet);
while (judgee(sweet)) {
for (int i = 0; i < 10; i++)
if (sweet[i] % 2 == 0)
t[i] = sweet[i] = sweet[i] / 2;
else
t[i] = sweet[i] = (sweet[i] + 1) / 2;
for (int l = 0; l < 9; l++) {
sweet[l + 1] = sweet[l+1] + t[l];
sweet[0] += t[9];
print(sweet);
}
}
return 0;
}
int judgee(int c[]) {
for (int i = 0; i < 10; i++) {
if (c[0] != c[i]) {
return 1;
}
}
return 0;
}
void print(int s[]) {
cout << j++<<" ";
for (int k = 0; k < 10; k++) {
cout << s[k]<<" ";
}
cout << endl;
}