#include <iostream>
#include <cstdio>
#include <cstring>
int a[10010];
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
#endif
int n, q;
int num;
int test_case = 0;
while(scanf("%d%d", &n, &q) == 2) {
if(n==0 && q==0) break;
memset(a, 0, sizeof(a));
while(n--) {
scanf("%d", &num);
a[num]++;
}
int pre=1, temp;
for(int i=1; i<=10000; i++) {
if(a[i] > 0) {
temp = pre + a[i];
a[i] = pre;
pre = temp;
}
}
printf("CASE# %d:\n", ++test_case);
while(q--) {
scanf("%d", &num);
if(a[num] <= 0) printf("%d not found\n", num);
else printf("%d found at %d\n", num, a[num]);
}
}
return 0;
}
UVa 10474 - Where is the Marble?
最新推荐文章于 2019-11-02 16:59:11 发布