import java.io.*;
class Person{
public int id;
public boolean status=false;
Person next;
Person(int id){this.id=id;}
void setStatus(){ status=true; }
public void numAction(){ Game.M--; }
void offAction(){
Game.N--;
System.out.println("I'm out now: "+id);
}
}
public class Game{
public static int M=10;
public static int N=100;
public static boolean C=false;
Person head=new Person(1);
void go(){
//now form the round:
Person p=head;
for(int i=2;i<=N;i++)
{
Person temp=new Person(i);
p.next=temp;
p=temp;
}
p.next=head;
//now check the round:
System.out.println("Now check the round:");
Person pn=head;
int i=0;
while(pn!=p)
{
if(i%10==0) System.out.println();
i++;
System.out.print(pn.id+" ");
pn=pn.next;
}
System.out.println(pn.id);
//Now the game starts finally:
Person ps=head;
while(N>0)
{
M=10;
while(M>1)
{
if(!ps.status)
{
ps.numAction();
ps=ps.next;
}
else ps=ps.next;
}
//handle the last number of M:
while(ps.status) ps=ps.next;
ps.setStatus();
ps.offAction();
ps=ps.next;
}
}
public static void main(String args[])
{
Game g=new Game();
g.go();
}
}
class Person{
public int id;
public boolean status=false;
Person next;
Person(int id){this.id=id;}
void setStatus(){ status=true; }
public void numAction(){ Game.M--; }
void offAction(){
Game.N--;
System.out.println("I'm out now: "+id);
}
}
public class Game{
public static int M=10;
public static int N=100;
public static boolean C=false;
Person head=new Person(1);
void go(){
//now form the round:
Person p=head;
for(int i=2;i<=N;i++)
{
Person temp=new Person(i);
p.next=temp;
p=temp;
}
p.next=head;
//now check the round:
System.out.println("Now check the round:");
Person pn=head;
int i=0;
while(pn!=p)
{
if(i%10==0) System.out.println();
i++;
System.out.print(pn.id+" ");
pn=pn.next;
}
System.out.println(pn.id);
//Now the game starts finally:
Person ps=head;
while(N>0)
{
M=10;
while(M>1)
{
if(!ps.status)
{
ps.numAction();
ps=ps.next;
}
else ps=ps.next;
}
//handle the last number of M:
while(ps.status) ps=ps.next;
ps.setStatus();
ps.offAction();
ps=ps.next;
}
}
public static void main(String args[])
{
Game g=new Game();
g.go();
}
}