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:我是按diacuss里面讨论的方法写的,为什么不对...请大牛帮我小查一下...

Posted by acmfan at 2006-08-06 01:12:07 on Problem 2926
In Reply To:我是按diacuss里面讨论的方法写的,为什么不对...请大牛帮我小查一下... Posted by:lxp_rs at 2006-08-05 22:08:14
> #include "stdio.h"
> #include "math.h"
> 
> double a[100000][5];
> 
> int main()
> {
>     int n,i,j;
>     double sum,max,min,MAX;
>     while(scanf("%d",&n)!=EOF)
>     {
>           MAX=0;
>           for(i=0;i<n;i++)      
> 		  {
>               for(j=0;j<5;j++)
>                   scanf("%lf",&a[i][j]);          
> 		  }
>           for(double g=0;g<2;g++)
>           {
>                 for(double b=0;b<2;b++)
>                   for(double c=0;c<2;c++)
>                        for(double d=0;d<2;d++)
>                            for(double e=0;e<2;e++)
>                            {
>                                    max=-100000;min=100000;
>                                    for(i=0;i<n;i++)
>                                    {
>                                       sum=a[i][0]*pow(-1,g)+a[i][1]*pow(-1,b)+a[i][2]*pow(-1,c)+a[i][3]*pow(-1,d)+a[i][4]*pow(-1,e);
>                                       if(sum>max) max=sum;
>                                       if(sum<min) min=sum;
>                                    }
>                                    if((max-min)>MAX) 
>                                          MAX=max-min;
>                            }
>           }  
>           printf("%.2lf\n",MAX);  
>     }
>     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