sdut1294选票统计

#include
int main()
{
    int i,j,max,a[1001],m,n,k;
    scanf("%d %d\n",&i,&j);
    for(m=1; m<=i; m++)
    {
        a[m]=0;
    }
    for(n=1; n<=j; n++)
    {
        scanf("%d",&k);
        a[k]++;
    }
    max=0;
    k=0;
    for(m=1; m<=i; m++)
    {
        if(a[m]>max)
        {
            max=a[m];
            k=m;
        }
    }
    printf("%d\n",k);
    printf("%d",max);
}

/***************************************************
User name: TJRAC6015203228魏杰
Result: Accepted
Take time: 0ms
Take Memory: 108KB
Submit time: 2016-10-31 22:06:21
****************************************************/

你可能感兴趣的:(sdut,ACM算法入门)