| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
相加的时候溢出了!In Reply To:这程序究竟怎么了????????????????????????????????????????????????????极度不爽中 Posted by:iowyh at 2005-10-02 14:12:57 > #include<stdlib.h>
>
>
> int cmp(void const *a,void const *b)
> {
> return *(long *)a-*(long *)b;
> }
>
>
> void main()
> {
> long num[250000];
> int m,i;
> scanf("%d",&m);
> for(i=0;i<m;i++)
> scanf("%ld",&num[i]);
> qsort(num,m,sizeof(long),cmp);
> if(m%2!=0)
> printf("%.1f\n",(float)num[m/2]);
> else
> printf("%.1f\n",(float)(num[m/2-1]+num[m/2])/2.0);
> }
>
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator