#include <iostream>
using namespace std;
int KillMan(int a[],int nLen,int key)
{
int i = 0 ,j = 0 ,count = 0,killerNum = 0;
bool flag = true;
if(nLen < key)
return -1;
while(flag)
{
if(a[i] == 0)
{
count ++;
}
if(count == key)
{
a[i] = 1;
cout<<i+1<<”,”;
count = 0;
killerNum ++;
}
if(i == nLen -1)
{
i = -1;
}
if(killerNum == nLen -1)
flag = false;
i++;
}
for(;j< nLen;j++)
if(a[j]!= 1)
cout<<”alive:”<<j+1;
return 0;
}
int main()
{
int a[10];
for(int i=0;i<10;i++)
a[i] = 0;
KillMan(a,10,1);
return 0;
}