又找了一道很水的题a了下,纯属无聊,还是把地址和代码贴上来吧:
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=514
#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
int m, n,x, sum,i,ticket[10009];
while (scanf("%d%d", &n, &m) && (m != 0 && n != 0)){
sum = 0;
for (i = 1; i <= n; i++)
ticket[i] = 0;
for (i = 1; i <= m; i++){
scanf("%d", &x);
ticket[x]++;
}
for (i = 1; i <= n; i++){
if (ticket[i]>1)
sum ++;
}
printf("%d\n", sum);
}
return 0;
}