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

为什么Wrong answer?请各位大牛帮我看看

Posted by wzp_moon at 2015-08-24 18:02:08 on Problem 1547
#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:
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