太水了

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;
int main()
{
int n,k,m;
scanf("%d%d",&n,&k);
int a[n+5];
for(int i=0;i<=n+5;i++)
{a[i]=0;}

for(int i=1;i<=n;i++)
{
int f=-1;
while(f!=0)
{
scanf("%d",&f);
a[f]++;
}
}
int tot=0;
for(int i=1;i<=n;i++)
{
if(a[i]>=k)tot++;
}
printf("%d ",tot);
// system("pause");
return 0;
}

3 条评论

  • @ 2014-10-29 19:41:46

    ……

  • @ 2014-10-12 21:01:58

    #include<iostream>
    #include<cstdio>
    #include<cstdlib>
    #include<algorithm>
    using namespace std;
    int main()
    {
    int n,k,m;
    scanf("%d%d",&n,&k);
    int a[n+5];
    for(int i=0;i<=n+5;i++)
    {a[i]=0;}
    for(int i=1;i<=n;i++)
    {
    int f=-1;
    while(f!=0)
    {
    scanf("%d",&f);
    a[f]++;
    }
    }
    int tot=0;
    for(int i=1;i<=n;i++)
    {
    if(a[i]>=k)tot++;
    }
    printf("%d ",tot);
    // system("pause");
    return 0;
    }

  • @ 2013-07-25 17:43:35

    编译错误

  • 1

信息

ID
1021
难度
3
分类
贪心 点击显示
标签
递交数
6420
已通过
3219
通过率
50%
被复制
22
上传者