#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn = 10000;
int main()
{
int n, q, x, a[maxn], kase = 0;
while(scanf("%d%d", &n, &q) == 2 && n) //1
{
printf("CASE# %d:\n", ++kase);
for(int i = 0; i < n; i++)scanf("%d", &a[i]);
sort(a, a+n); //2从小到大
while(q--)
{
scanf("%d", &x);
int p = lower_bound(a, a+n, x) - a; //3大于或等于x的第一个位置
if(a[p] == x)printf("%d found at %d\n", x, p+1);
else printf("%d not found\n", x);
}
}
return 0;
}
UVa 10474 Where is the Marble?
最新推荐文章于 2023-01-23 13:45:18 发布