#include"stdio.h"
#include"stdlib.h"
#define N 100
int main()
{
int t[N];
int i, n, j = 1, k, s;
printf("请输入人数不能大于100:");
scanf("%d", &n);
for (i = 0; i < n; i++)
t[i] = 1;
for (i = 0;; i++)
{
if (i == n)
i = 0;
s = 0;
for (k = 0; k < n; k++)
if (t[k] == 1)
s++;
if (s == 1)
break;
if (t[i] == 0)
continue;
j++;
if(j==3)
{
t[i] = 0;
j = 1;
}
}
for (k = 0; k < n; k++)
if (t[k] == 1)
break;
printf("最后留下的是原来第%d号\n", ++k);
system("pause");
}