C++ 代码
#include<iostream>
using namespace std;
const int N=8;
int a[N][N],n;
int main()
{
for(int i=1;i<=6;i++)
scanf("%d",&a[1][i]);
scanf("%d",&n);
int res[7]={0,6,6,6,6,6,6};
for(int i=2;i<=6;i++)
for(int j=1;j<=6;j++)
{
if(res[j]==a[1][j])
res[j]--;
a[i][j]=res[j];
res[j]--;
}
for(int i=1;i<=5;i++)
printf("%d ",a[n+1][i]);
cout<<a[n+1][6];
puts("");
return 0;
}