Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这都能过.....

Posted by zjnu09200129 at 2010-10-30 15:12:39 on Problem 2388
#include<stdio.h>
int a[1000001];
int b[10001];
int main()
{
	int i,j,k,n,mid;
	while (scanf("%d",&n)!=EOF)
	{
        for (i=0;i<=1000000;i++)
	    	a[i]=0;
	    for (i=1;i<=n;i++)
	    {
	    	scanf("%d",&k);
	    	a[k]++;
	    }
        j=0;
        for (i=1;i<=1000000;i++)
        while (a[i]>0)
        {
        	j++;
        	b[j]=i;
        	a[i]--;
        }
        if (n%2==1) printf("%d\n",b[(n+1)/2]);
        else printf("%d",(b[n/2]+b[n/2+1])/2);
	}
	return 0;	
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator