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 <stdio.h> const double inf = 1e250; struct score { double x1, x2, x3, x4, x5; double ans[16]; }a[100005]; void slove(int i, double x1, double x2, double x3, double x4, double x5) { a[i].ans[0] = x1 + x2 + x3 + x4 + x5; a[i].ans[1] = -x1 + x2 + x3 + x4 + x5; a[i].ans[2] = x1 - x2 + x3 + x4 + x5; a[i].ans[3] = x1 + x2 - x3 + x4 + x5; a[i].ans[4] = x1 + x2 + x3 - x4 + x5; a[i].ans[5] = x1 + x3 + x3 + x4 - x5; a[i].ans[6] = -x1 - x2 +x3 + x4 + x5; a[i].ans[7] = -x1 + x2 - x3 + x4 + x5; a[i].ans[8] = -x1 + x2 + x3 - x4 + x5; a[i].ans[9] = -x1 + x2 + x3 + x4 - x5; a[i].ans[10] = x1 - x2 - x3 + x4 + x5; a[i].ans[11] = x1 - x2 + x3 - x4 + x5; a[i].ans[12] = x1 - x2 + x3 + x4 - x5; a[i].ans[13] = x1 + x2 - x3 - x4 + x5; a[i].ans[14] = x1 + x2 - x3 + x4 - x5; a[i].ans[15] = x1 + x2 + x3 - x4 - x5; } int main() { int n, i, j; double maxans, maxx, minx, tmp; while(scanf("%d", &n) != EOF && n){ for(i = 1;i <= n;i++){ scanf("%lf%lf%lf%lf%lf", &a[i].x1, &a[i].x2, &a[i].x3, &a[i].x4, &a[i].x5); slove(i, a[i].x1, a[i].x2, a[i].x3, a[i].x4, a[i].x5); } maxans = -inf; for(i = 0;i <= 15;i++){ maxx = -inf; minx = inf; for(j = 1;j <= n;j++){ if(a[j].ans[i] < minx) minx = a[j].ans[i]; if(a[j].ans[i] > maxx) maxx = a[j].ans[i]; } tmp = maxx - minx; if(tmp > maxans) maxans = tmp; } printf("%.2lf\n", maxans); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator