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

直接算怎么会wa呀.

Posted by wuji0447 at 2006-08-26 16:33:00 on Problem 2926
#include "iostream"
#include "math.h"
using namespace std;

int main(int argc, char* argv[])
{   int s,i,j,k;
    cin>>s;
	float sum1,min=10000,max=0;
    float a[1000][5];
	for(i=0;i<s;i++)
		for(j=0;j<5;j++)
			cin>>a[i][j];
    for(i=0;i<s-1;i++)
		for(k=i+1;k<s;k++)
		{for(j=0,sum1=0;j<5;j++)
			sum1+=fabs(a[k][j]-a[i][j]);
		 if(sum1>max) max=sum1;
		   
		}

    printf("%.2f\n",max);
/*   for(i=0,sum1=0;i<5;i++)
		sum1+=fabs(a[imax][i]-a[imin][i]);
	if(sum1>max)  printf("%.2f\n",sum1);
        else      printf("%.2f\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