http://www.bianchengla.com/course/ds2009/practise/problem?id=1338
/*
//第一种解法。按题目要求做的
#include<stdio.h>
#include<stdlib.h>
typedef struct Node
{
int data;
struct Node *next;
}LNode;
LNode *h;
void CreatList(int n)
{
h = (LNode*)malloc(sizeof(LNode));
LNode *q;
int i = n;
h->data = n;
h->next = NULL;
while(--i) //采用头插法创建链表
{
q = (LNode*)malloc(sizeof(LNode));
q->data = i;
q->next = h;
h = q;
}
}
void Destroy()
{
LNode *p = h;
while(p!=NULL)
{
p = p->next;
free(h);
h = p;
}
}
void DelElem(int k,int n)
{
int i = n-k;
LNode *p = h,*q;
if (i==0) //删除第一个元素
{
p = p->next;
free(h);
h = p;
return;
}
while(--i>0)p = p->next; //指针移动到该删除元素的第一个
q = p->next;
p->next = q->next;
free(q);
}
void Dis()
{
int first = 1;
LNode *p = h;
while(p!=NULL)
{
if(first==1)first = 0;
else printf(" ");
printf("%d",p->data);
p = p->next;
}
printf("\n");
}
int main()
{
int n,k;
scanf("%d%d",&k,&n);
CreatList(n);
// Dis();
DelElem(k,n);
Dis();
Destroy();
return 0;
}
*/
//第二种解法,直接输出
#include<stdio.h>
int main()
{
int i,k,n,first=1;
scanf("%d%d",&k,&n);
for(i=0;i<n;i++)
{
if (i==(n-k))continue;
if (!first)printf(" ");
else first = 0;
printf("%d",i+1);
}
printf("\n");
}