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 |
为什么Wrong answer?请各位大牛帮我看看#include <stdio.h> #define LEN 10 typedef struct{ short len; short wide; short high; char stu_name[LEN]; }STUDENT; int main(void) { int n,i,j,k; STUDENT stu[LEN]; int stu_kind; int stu_evil; int tmp_v = 0; int v = 0; scanf("%d",&n); while(n != -1) { for (i = 0;i < n;i++) { scanf("%d %d %d %s",&stu[i].len,&stu[i].wide,&stu[i].high,stu[i].stu_name); } for (j = 0;j < n;j++) { tmp_v = stu[j].len * stu[j].wide * stu[j].high; if(tmp_v > v) { v = tmp_v; stu_evil = j; } } tmp_v = 0; v = stu[0].len * stu[0].wide * stu[0].high; stu_kind = 0; for (k = 1;k < n;k++) { tmp_v = stu[k].len * stu[k].wide * stu[k].high; if (tmp_v < v) { v = tmp_v; stu_kind = k; } } printf("%s took clay from %s.\n",stu[stu_evil].stu_name,stu[stu_kind].stu_name); scanf("%d",&n); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator