UVA 10474

#include<iostream>
using namespace std;
int main()
{
    int n,m,i,temp,flag=1;
    while(cin>>m>>n)
    {
        if(m==0&&n==0)break;
        cout<<"CASE# "<<flag++<<":"<<endl;
        int  a[10001]={0},b[10001]={0};
        for(i=0;i<m;i++)
        {
            cin>>temp;
            a[temp]++;
        }
        for(i=1;i<=10000;i++)
            b[i]=b[i-1]+a[i];
        for(i=0;i<n;i++)
        {
            cin>>temp;
            if(a[temp]==0)
                cout<<temp<<" not found"<<endl;
            else
                cout<<temp<<" found at "<<b[temp-1]+1<<endl;
        }
    }
    return 0;
}

 

posted @ 2012-04-28 12:22  open your eyes  阅读(227)  评论(0编辑  收藏  举报