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

这样都ac,证明没溢出。。a positive integer not greater than 2^32 - 1 inclusive忽悠的吧

Posted by 3250 at 2009-05-29 10:57:28 on Problem 2623
//要 c++ 提交才行 
#include <stdio.h>
#include <algorithm>
#define maxn 250001
int compare(const void * a,const void * b)
{
	return *((int*)a)-*((int*)b);
}

int main()
{
   // freopen("in.txt","r",stdin);
   // freopen("out.txt","w",stdout);
    int a[maxn];
    int n,i;
    while(scanf("%d",&n)!=EOF){
        for(i=0;i<n;i++){
            scanf("%d",&a[i]);
            if(a[i]<0) printf("error\n");
        }
        qsort(a,n,sizeof(a[0]),compare);
        if(n%2==1) printf("%.1lf\n",(double)a[n/2]);
        else {
            printf("%.1lf\n",((double)a[n/2]+a[n/2-1])/2);
        }
    }
    return 1;
}

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