UVa 10474

so easy...
/* UVas */
/*****************************************************************************/
int n, q, t, c=1;
int main(void) {
    while (cin>>n>>q&&n&&q) {
        int m[n];
        for (int i=0; i<n; i++) {
            cin>>m[i];
        }
        cout<<"CASE# "<<c<<":"<<endl;
        for (int i=0; i<q; i++) {
            cin>>t;
            int r=0, f=0;
            for (int j=0; j<n; j++) {
                if (m[j]<t) {
                    r++;
                }
                if (m[j]==t) {
                    f=1;
                }
            }
            f?cout<<t<<" found at "<<r+1:cout<<t<<" not found";
            cout<<endl;
        }
        c++;
    }
    return 0;
}
/*****************************************************************************/

No comments :

Post a Comment