-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwhere_is_marble.cpp
More file actions
36 lines (34 loc) · 961 Bytes
/
where_is_marble.cpp
File metadata and controls
36 lines (34 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{ int n , q,Case=0;
while(cin>>n>>q)
{ if(n==0&&q==0)break;
int arr[10009];
for(int i=0;i<n;i++)
cin>>arr[i];
sort(arr,arr+n);
cout<<"CASE# "<<++Case<<":"<<endl;
while(q)
{
int queriy;
cin>>queriy;
bool result=false;
for(int i=0;i<n;i++)
{
if(arr[i]==queriy) //5 found at 4
{
cout<<queriy<<" found at " <<i+1<<endl;
result = true;
break;
}
if(arr[i]>queriy) break;
}
if(result != true) //2 not found
cout<<queriy<<" not found"<<endl;
q--;
}
}
return 0;
}