这题目额就是个模板题目,就看一看石头上的数字是否符合我给的,额很简单,排序之后就搜索一下,搜索的话还可以用二分降低一下时间复杂度。
// 大理石在哪里.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
int n, p;int kase = 0;
while (scanf("%d %d", &n, &p) && (n != 0 && p != 0))
{
int a[10010];
for (int i = 0;i < n;i++)
{
cin >> a[i];
}
sort(a, a + n);
printf("CASE# %d:\n", ++kase);
while (p--)
{
int x;
cin >> x;
int t = lower_bound(a, a + n, x) - a;
if (a[t] == x)cout << x << " found at " << t+1 << endl;
else cout << x << " not found" << endl;
}
}
}