Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int n,m,c,cnt=0;
- while(1){
- cnt++;
- scanf("%d %d",&n,&m);
- if(n==0 && m==0)
- break;
- int i,j,a[10000],temp;
- for(i=1;i<=n;i++){
- scanf("%d",&a[i]);
- }
- for(i=1;i<=n;i++){
- for(j=i+1;j<=n;j++){
- if(a[i]>a[j]){
- temp=a[i];
- a[i]=a[j];
- a[j]=temp;
- }
- }
- }
- int t,max;
- printf("CASE# %d:\n",cnt);
- for(i=1;i<=m;i++){
- max=0;
- scanf("%d",&t);
- for(j=1;j<=n;j++){
- if(a[j]==t){
- printf("%d found at %d\n",t,j);
- max++;
- break;
- }
- }
- if(max==0)
- printf("%d not found\n",t);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement