请大神用c语言来编程,不是c++

(请大神用c语言编程,不是c++。完成加微信重酬)看病要排队这个是地球人都知道的常识。
  不过经过细心的0068的观察,他发现了医院里排队还是有讲究的。0068所去的医院有三个医生(汗,这么少)同时看病。而看病的人病情有轻重,所以不能根据简单的先来先服务的原则。所以医院对每种病情规定了10种不同的优先级。级别为10的优先权最高,级别为1的优先权最低。医生在看病时,则会在他的队伍里面选择一个优先权最高的人进行诊治。如果遇到两个优先权一样的病人的话,则选择最早来排队的病人。
  现在就请你帮助医院模拟这个看病过程。
  Input
  输入数据包含多组测试,请处理到文件结束。
  每组数据第一行有一个正整数N(0<N<2000)表示发生事件的数目。
  接下来有N行分别表示发生的事件。
  一共有两种事件:
  1:"IN A B",表示有一个拥有优先级B的病人要求医生A诊治。(0
  2:"OUT A",表示医生A进行了一次诊治,诊治完毕后,病人出院。(0
  Output
  对于每个"OUT A"事件,请在一行里面输出被诊治人的编号ID.如果该事件时无病人需要诊治,则输出"EMPTY".
  诊治人的编号ID的定义为:在一组测试中,"IN A B"事件发生第K次时,进来的病人ID即为K.从1开始编号。
  思路:此题用优先级队列比较容易,但是注意优先级队列是用堆来实现的,是不稳定的排序。
  Sample Input
  7
  IN 1 1
  IN 1 2
  OUT 1
  OUT 2
  IN 2 1
  OUT 2
  OUT 1
  2
  IN 1 1
  OUT 1
  Sample Output
  2
  EMPTY
  3
  1
  1

http://blog.csdn.net/xjbscut123456/article/details/5379273
这里有C++的,改成C语言无非就是自己实现一个链表或者数组,完成排序。

可以出结果,都对。感兴趣可以编译运行一下
但是没有通过我学校的程序设计系统,要是发现有纰漏的地方,希望可以跟帖指出
#include
#include
#include
typedef struct que{
struct que*previous;
int a;
int b;
int id;
struct que*next;

}queue;
typedef struct {
queue*front;
queue*rear;
}list;
//typedef list* ls;
void makenull(list*);
void ints(list*,int*);
void outs(list*);

int main(void)
{
int n;
int k;
char app[5];
list ls;

while(scanf("%d",&n)!=EOF)
{  
    if(n>0&&n<2000)
    {
         while(getchar()!='\n')
          continue; 
     k=1;
    makenull(&ls);
    while(n--)
    {
        gets(app);
        if(strcmp(app,"IN")==0)
        ints(&ls,&k);
      else if(strcmp(app,"OUT")==0)
        outs(&ls);
    }
    }
}
return 0;

}

void makenull(list*current)
{
current->front=NULL;
current->rear=NULL;

}
void ints(list*current,int*k)
{
int i,j,c=0,d=0;
queue*news,*plot,*sh;
scanf("%d",&i);
scanf("%d",&j);
while(getchar()!='\n')
continue;
if(i>0&&i<=3&&j>0&&j<=10)
{
news=(queue*)malloc(sizeof(queue));
news->a=i;
news->b=j;
news->id=(*k)++;
news->next=NULL;
news->previous=NULL;

if(current->front==NULL&&current->rear==NULL)
current->rear=current->front=news;
else
{
    plot=current->front;
    while(plot!=NULL)
    {

        if((plot->b)>=j)
        {   
            d=1;
            if(c==0)
            {
                news->next=plot;
                plot->previous=news;
                current->front=news;
            }
            else
            {
                news->next=sh->next;
                news->previous=sh;
                sh->next->previous=news;
                sh->next=news;
            }
            break;
        }

        sh=plot;
        c++;
        plot=plot->next;

    }
    if(d==0)
    {
        current->rear->next=news;
        news->previous=current->rear;
        current->rear=news;
    }
}

}
}

void outs(list*current)
{
int n,k=0,c=0;
queue*plot,*as=NULL;
scanf("%d",&n);
while(getchar()!='\n')
continue;
if(current->rear==current->front)
{

    if(current->rear!=NULL&&current->rear->a==n)
    {
        printf("%d\n",current->rear->id);
        as=current->rear;
        makenull(current);
        free(as);
    }
    else
    printf("EMPTY\n");
}
else
{ 
    plot=current->rear;
    while(plot!=NULL)
   {
    if(plot->a==n)
    {
        c=1;
       if(k==0)
       {
        printf("%d\n",plot->id);
        current->rear=plot->previous;
        current->rear->next=NULL;
        free(plot);

           }
           else
           {
               if(plot==current->front)
               {
                   printf("%d\n",plot->id);
                   current->front=plot->next;
                   plot->next->previous=NULL;
                   free(plot);
                  }
                  else
                  {
                    printf("%d\n",plot->id);
                    plot->previous->next=plot->next;
                    plot->next->previous=plot->previous;
                    free(plot);
                  }
               }
               break;   
    }

    plot=plot->previous;
    k++;
   }
   if(c==0)
   {
    puts("EMPTY\n");
   }        
}   

}

前面三个包含是stdio.h string.h stdlib.h