1 solutions

  • 0
    @ 2025-11-5 16:59:04

    C :

    #include <stdio.h>
    #include <string.h>
    int a[5000001];
    int main()
    {
    	int n, x;
    	while(scanf("%d",&n) != EOF)
    	{
    		memset(a,0,sizeof(a));
    		for(int i = 0 ; i < n ; i ++)
    		{
    			scanf("%d",&x);
    			a[x] ++;
    		}
    
    		int max = -1, index = -1;
    		for(int i = 5000000 ; i >= 0 ; i --)
    		{
    			if(a[i] > max)
    			{
    				max = a[i];
    				index = i;
    			}
    		}
    
    		printf("%d\n",index);
    	}
    	return 0;
    }
    
    • 1

    Information

    ID
    18113
    Time
    2000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By