/* 算是水题,难度不大 有个值得注意的小细节是,CASE的每个字母都是大写的,而不仅仅是第一个,为此WA一次 值得学习的函数: sort对vector排序时:sort(v.begin(), v.end()) lower_bound: 查找“大于或等于x的第一个位置” */ #include <iostream> #include <cstdio> #include <algorithm> using namespace std; const int maxn = 1e4; int a[maxn]; int main() { int n, q, x, kase = 0; while ( scanf("%d%d", &n, &q) == 2 && n) { printf("CASE# %d: ", ++kase); for (int i = 0; i < n; i++) scanf("%d", a + i); sort(a, a + n); while (q--) { scanf("%d", &x); int p = lower_bound(a, a + n, x) - a; if (a[p] == x) printf("%d found at %d ", x, p + 1); else printf("%d not found ", x); } } return 0; }