import java.util.Scanner;
public class text13{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("請輸入總人數:");
int p = input.nextInt();
// boolean數組表示站成一圈的人,false表示退出
boolean[] liu = new boolean[p];
for (int i = 0; i < liu.length; i++)
{
liu[i] = true;
}
int t = 0, len = liu.length;
while (len > 1)
{
for (int i = 0; i < liu.length; i++)
{
if (liu[i])
{
t++;
if (t ==4)
{
t = 0;
liu[i] = false;
len--;
}
}
}
}
for (int i = 0; i < liu.length; i++)
{
if (liu[i])
{
System.out.println("留下來的是第:"+(i+1)%4+"號位");
}
}
}
} //版權所有
*