标签:des style blog io color for sp 数据 div
1 #include <stdio.h> 2 3 int main(){ 4 int n; 5 int m; 6 int i; 7 int j; 8 int flag1; 9 int flag2; 10 int temp; 11 int n_number[101]; 12 int m_number[101]; 13 14 while(1){ 15 flag2=0; 16 scanf("%d%d",&n,&m); 17 18 if(n==0 && m==0) 19 break; 20 21 for(i=0;i<n;i++) 22 scanf("%d",&n_number[i]); 23 24 for(i=0;i<n-1;i++){ //题目要求集合A从小到大输出,对A集合先排序 25 for(j=i+1;j<n;j++){ 26 if(n_number[i]>n_number[j]){ 27 temp=n_number[i]; 28 n_number[i]=n_number[j]; 29 n_number[j]=temp; 30 } 31 } 32 } 33 34 for(i=0;i<m;i++) 35 scanf("%d",&m_number[i]); 36 37 for(i=0;i<n;i++){ 38 flag1=0; 39 for(j=0;j<m;j++){ 40 if(n_number[i]==m_number[j]){ 41 flag1=1; 42 break; 43 } 44 } 45 46 if(flag1==0){ 47 printf("%d ",n_number[i]); 48 flag2=1; 49 } 50 51 } 52 53 if(flag2==0) 54 printf("NULL"); 55 56 printf("\n"); 57 58 59 } 60 61 62 63 return 0; 64 }
标签:des style blog io color for sp 数据 div
原文地址:http://www.cnblogs.com/zqxLonely/p/4054661.html