-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1025.cpp
43 lines (30 loc) · 895 Bytes
/
1025.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
using namespace std;
int cmp(const void* a, const void* b){
return(*(int*) a - *(int*) b);
}
int main(){
int N,Q, cont = 1;
while(true){
cin >> N >> Q;
if(N == 0 && Q == 0) break;
int m[N], c[Q];
for(int i=0; i<N; i++) cin >> m[i];
for(int i=0; i<Q; i++) cin >> c[i];
qsort(m,N,sizeof(int),cmp);
cout << "CASE# " << cont << ":\n";
for(int i=0; i<Q; i++){
int indice = -1;
for(int j=0; j<N; j++){
if(c[i] == m[j]){
indice = j+1;
break;
}
}
if(indice == -1) cout << c[i] << " not found\n";
else cout << c[i] << " found at " << indice << "\n";
}
cont++;
}
return 0;
}