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 zhucheng at 2005-10-02 14:15:13 on Problem 2623
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:
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