#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
const int N = 10000;
int main(){
int n, x, q, a[N], kase = 0;
int i,temp;
while (scanf("%d %d", &n, &q) != EOF){
//printf("CASE # %d:\n", ++kase);
for (i = 0; i < n; i++)
scanf("%d",&a[i]);
for (i = 0; i < n-1; i++)
for (int j = 0; j < n -i-1 ; j++){
if (a[j]>a[j + 1]){
temp = a[j];
a[j] = a[j + 1];
a[j + 1] = temp;
}
}
/*for (i = 0; i < n; i++)
cout << a[i] << endl;*/
while (q--){
cin >> x;
printf("CASE # %d:\n", ++kase);
for (i = 0; i < n; i++){
if (a[i] == x){
cout << x << " found at " << i + 1 << endl;
break;
}
}
if (i == n)
cout << x << " not found " << endl;
}
}
return 0;
}
刘汝佳-0-5-1
最新推荐文章于 2022-01-24 21:27:59 发布