紫书STL第一道题,简单题
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mk make_pair
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pa;
const int N = 10005;
int a[N];
int main() {
int n, q;
int cnt = 1;
while (cin >> n >> q && n) {
cout << "CASE# " << cnt++ << ":" << endl;
for (int i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
while (q--) {
int x;
cin >> x;
int t = lower_bound(a, a + n, x) - a;
if (t == n || t < n && a[t] != x) cout << x << " not found" << endl;
else cout << x << " found at " << t + 1 << endl;
}
}
return 0;
}