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 |
直接算怎么会wa呀.#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator