Uva10474——Where is the Marble?

来源:互联网 发布:无锡亿美网络 编辑:程序博客网 时间:2024/05/16 10:57
#include <algorithm>#include <iostream>using namespace std;const int maxn = 10000;int main(){int n, q, x, a[maxn], kase = 0;while(cin >> n >> q && n){for(int i = 0; i < n; i++)cin >> a[i];sort(a, a + n);cout << "CASE# " << ++kase << ":" << endl;while(q--){cin >> x;int p = lower_bound(a, a + n, x) - a;if(a[p] == x)cout << x << " found at " << p + 1 << endl;elsecout << x << " not found" << endl;}}return 0;}

0 0
原创粉丝点击