UVa10474

时间:2023-03-09 21:27:15
UVa10474
#include <bits/stdc++.h>
using namespace std; const int maxn=;
int main()
{
int n,q,x;
int kase=;
int a[maxn];
while(cin>>n>>q)
{
if(n== && q==)
break;
cout<<"CASE# "<<++kase<<":"<<endl;
for(int i=;i<=n;i++)
cin>>a[i];
sort(a+,a+n+);
while(q--)
{
cin>>x;
int t=lower_bound(a+,a+n+,x)-a;
if(a[t]==x)
cout<<x<<" found at "<<t<<endl;
else
cout<<x<<" not found"<<endl;
}
}
return ;
}

同样的模板,改了几个变量就一直超时,改了一早上也没发现什么问题