#include <stdio.h>
#include <stdlib.h>
//線形探索
int linear_search(int a[],int n,int x){
int i,ret,j=0;
ret=-1;
for(i=0; i<n; i++){
if(a[i]==x){
j+=1;
}
}
return j;
}
int main(void) {
int n,x,i;
int *a;
int ans = -1;
a
= (int*)malloc(sizeof(int)*n
); if(a==NULL){
return -1;
}
for(i=0;i<n;i++){
}
ans = linear_search(a,n,x);
if(ans
!= 0) printf("Found_%d_%ds\n",ans
,x
); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCi8v57ea5b2i5o6i57SiCmludCBsaW5lYXJfc2VhcmNoKGludCBhW10saW50IG4saW50IHgpewoJaW50IGkscmV0LGo9MDsKCXJldD0tMTsKCQoJZm9yKGk9MDsgaTxuOyBpKyspewoJCWlmKGFbaV09PXgpewoJCQlqKz0xOwoJCX0KCX0KCXJldHVybiBqOwp9CgppbnQgbWFpbih2b2lkKSB7CglpbnQgbix4LGk7CglpbnQgKmE7CglpbnQgYW5zID0gLTE7CglzY2FuZigiJWQgJWQiLCZuLCZ4KTsKCWEgPSAoaW50KiltYWxsb2Moc2l6ZW9mKGludCkqbik7CglpZihhPT1OVUxMKXsKCQlwcmludGYoIkVSUk9SXG4iKTsKCQlyZXR1cm4gLTE7Cgl9Cglmb3IoaT0wO2k8bjtpKyspewoJCXNjYW5mKCIlZCIsJmFbaV0pOwoJfQoJYW5zID0gbGluZWFyX3NlYXJjaChhLG4seCk7CglpZihhbnMgIT0gMCkgcHJpbnRmKCJGb3VuZF8lZF8lZHNcbiIsYW5zLHgpOwoJZWxzZSBwcmludGYoIm5vdCBmb3VuZFxuIik7CglmcmVlKGEpOwoJcmV0dXJuIDA7Cn0K
NTAgNQoxMgkzCTQJMTIJMTEJNQk3CTE1CTE4CTAJMAk1CTEwCTYJMTUJNgk0CTEwCTgJMTYJMTIJOQkxMAkxMQkxMgk5CTUJNwkxMAkxNAkzCTE3CTExCTEwCTcJMTUJNQkyCTYJMwkxOQk3CTgJMTYJMTMJMwkxOAkxMAkxOQk1
50 5
12 3 4 12 11 5 7 15 18 0 0 5 10 6 15 6 4 10 8 16 12 9 10 11 12 9 5 7 10 14 3 17 11 10 7 15 5 2 6 3 19 7 8 16 13 3 18 10 19 5