标签:des style blog io color ar sp for 数据
1 #include <stdio.h> 2 3 int main(){ 4 int array[20001]; 5 int n; 6 int m; 7 int i; 8 int j; 9 int k; 10 int number; 11 int flag; 12 int temp; 13 14 while(scanf("%d%d",&n,&m)!=EOF){ 15 for(i=0;i<n;i++){ 16 scanf("%d",&number); 17 array[i]=number; 18 } 19 20 k=n; 21 for(i=0;i<m;i++){ 22 scanf("%d",&number); 23 24 flag=0; 25 for(j=0;j<k;j++){ 26 if(number==array[j]){ 27 flag=1; 28 break; 29 } 30 } 31 32 if(flag==0){ 33 array[k]=number; 34 k++; 35 } 36 } 37 38 for(i=0;i<k-1;i++){ 39 for(j=i+1;j<k;j++){ 40 if(array[i]>array[j]){ 41 temp=array[i]; 42 array[i]=array[j]; 43 array[j]=temp; 44 } 45 } 46 } 47 48 for(i=0;i<k;i++) 49 if(i!=0) 50 printf(" %d",array[i]); 51 52 else 53 printf("%d",array[i]); 54 55 printf("\n"); 56 } 57 58 59 return 0; 60 }
标签:des style blog io color ar sp for 数据
原文地址:http://www.cnblogs.com/zqxLonely/p/4085132.html