50 lines
730 B
C
50 lines
730 B
C
#include <stdio.h>
|
|
|
|
int test_if_have_value(int a[100],int n,int value){
|
|
for(int i=0;i<n;i++){
|
|
if(a[i]==value)return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
int main()
|
|
{
|
|
int a[100],b[100],c[100],n1,n2,n_=0,temp;
|
|
scanf("%d",&n1);
|
|
for(int i=0;i<n1;i++){
|
|
scanf("%d",&a[i]);
|
|
}
|
|
scanf("%d",&n2);
|
|
for(int i=0;i<n2;i++){
|
|
scanf("%d",&b[i]);
|
|
}
|
|
|
|
for(int i=0;i<n1;i++){
|
|
for(int j=0;j<n2;j++){
|
|
if(a[i]==b[j]){
|
|
if(!test_if_have_value(c,n_,a[i])){
|
|
c[n_]=a[i];
|
|
n_++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
for(int i=0;i<n_;i++){
|
|
for(int j=i;j<n_;j++){
|
|
if(c[i]<c[j]){
|
|
temp=c[i];
|
|
c[i]=c[j];
|
|
c[j]=temp;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(n_==0)printf("No Answer");
|
|
else{
|
|
for(int i=0;i<n_;i++){
|
|
printf("%d ",c[i]);
|
|
}
|
|
}
|
|
return 0;
|
|
}
|