Saleh127

Untitled

May 14th, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define sc(a) scanf("%lld",&a)
  6. #define sc2(a,b) scanf("%lld %lld",&a,&b)
  7. int main()
  8. {
  9. int a[100000],c,d,e,f,i,j,k=1,l,q;
  10. while(1)
  11. {
  12. scanf("%d %d",&c,&q);
  13. if(c==0 && q==0) break;
  14. for(i=0;i<c;i++)
  15. {
  16. scanf("%d",&a[i]);
  17. }
  18. printf("CASE# %d:\n",k++);
  19. sort(a,a+c);
  20. while(q--)
  21. {
  22. cin>>d;
  23. e=0;
  24. for(j=0;j<c;j++)
  25. {
  26. if(a[j]==d)
  27. {
  28. e=j+1;
  29. break;
  30. }
  31. }
  32. if(e==0) printf("%d not found\n",d);
  33. else printf("%d found at %d\n",d,e);
  34. }
  35. }
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment