杭电acm1235

http://acm.hdu.edu.cn/showproblem.php?pid=1235

简单录入,遍历一次,输出结果

View Code
 1 #include<stdio.h>
 2 int main()
 3 {
 4     int n,i,a[1111],flag,t;
 5     while(scanf("%d",&n)&&n)
 6     {
 7        t=0;
 8        for(i=0;i<n;i++)
 9        {
10         scanf("%d",&a[i]);
11        }
12        scanf("%d",&flag);
13        for(i=0;i<n;i++)
14          if(a[i]==flag)
15          {
16            t++;
17          }
18        printf("%d\n",t);
19     }
20  return 0;
21 }
原文地址:https://www.cnblogs.com/huzhenbo113/p/3006475.html