#include
int main()
{
struct king{
int data;
struct king *next;
};
int i,m,n;
scanf("%d%d",&n,&m);
struct king *p,*head,*t,*tmp;
head=(struct king*)malloc(sizeof(struct king));
head->next=NULL;
head->data=1;
p=head; //循环链表
for (i=2;i<=n;i++)
{
t=(struct king*)malloc(sizeof(struct king));
t->data=i;
t->next=NULL;
p->next=t;
p=p->next;
}
p->next=head;
p=head; //删除链表
while(p->next!=p)
{
for(i=1;i
tmp=p->next;
p->next=p->next->next;
p=tmp->next;
free(tmp);
}
printf("%d",p->data);
getchar();
getchar();
return 0;
}