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

Re:help/是不是我没看懂题,过了的给点指点,看看我的这个错在那,它总是wrong 答案

Posted by udisk at 2008-06-02 20:26:55 on Problem 1153
In Reply To:help/是不是我没看懂题,过了的给点指点,看看我的这个错在那,它总是wrong 答案 Posted by:tanxiaohuagg at 2007-07-21 15:12:03
> #include<stdio.h>
> #include<math.h>
> main()
> {
>       long int a[100000],n,i,j,s,x,b,t;
>        i=0;
>      s=2147483647;
>       scanf("%d",&n);
>       while(i<n&&n>=2&&n<=100000&&scanf("%d",&a[i])&&a[i]<=10000000&&a[i]>=1)
>       {
>          i++;                                                                    
>        }                                                                      
>        for(i=0;i<n;i++)
>        {b=0;
>              for(j=0;j<n;j++)
>                 {
>                   x=fabs(a[i]-a[j]);
>                   if(x<5000000) t=x;
>                    else t=10000000-x;
>                    b+=t; 
>                  }
>       if(b<s)s=b; 
>       }    
>       printf("%d\n",s);
>       
> }      
>       

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