#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct student{
int num;
int score;
struct student *next;
};
struct student *creat(int n){
struct student *head,*tail,*p;
int i;
head=(struct student*)malloc(n*sizeof(struct student*));
tail=head;
for(i=0;i<n;i++){
p=(struct student*)malloc(n*sizeof(struct student*));
scanf("%d %d",&p->num,&p->score);
tail->next=p;
tail=p;
}
tail->next=NULL;
return head;
}
struct student *DeleteCommon(struct student *a,struct student *b){
struct student *p1,*p2,*prep;
int judge;
for(prep=a,p1=a->next;p1 != NULL;p1=p1->next){
judge=1;
for(p2=b->next;p2 != NULL;p2=p2->next){
if(p1->num == p2->num){
prep->next=p1->next;//删除节点
judge=0;
break;
}
}
if(judge) prep=prep->next;
}
return a;
}
int print(struct student *a){
struct student *p=a;
while(p->next != NULL){
p=p->next;
printf("%d %d\n",p->num,p->score);
}
return 0;
}
int main()
{
struct student *a,*b,*p;
int n,m;
scanf("%d %d",&n,&m);
a=creat(n);
b=creat(m);
DeleteCommon(a,b);
int i=0;
for(p=a;p->next != NULL;p=p->next){
i++;
}
printf("%d\n",i);
print(a);
return 0;
}
0.0分
0 人评分