package com;
//约瑟夫出圈问题。
/**
* @(#)YueSeFu.java
*
*
* @author
* @version 1.00 2008/12/1
*/
class Node{//定义个节点存储数值和类型。
boolean flag;
int data;
Node next;
Node(int data){
this.data=data;
[code="java"][/code]
this.flag=false;
this.next=null;
}
public Node getNext(){
return this.next;
}
public void setNext(Node next){
this.next=next;
}
}
public class YueSeFu{
Node first=null;
Node end=null;
public static void main(String srgs[]){
YueSeFu ysf=new YueSeFu();
for(int i=1;i0){
for(int i=1;i0){
head=head.next;
k--;
}
head=head.next;
int f=10;
while(head.flag&&f>0){
head=head.next;
f--;
}
}
System.out.println(head.data+"out");
head.flag=true;
head=head.next;
n--;
}
}
}