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 wangfengtian at 2008-12-07 19:34:52 on Problem 2291
#include<stdio.h>
void main()
{
	int n,i,j,k,c,max,t,a,b[1000];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a);
		for(j=0;j<a;j++)
			scanf("%d",&b[j]);
		for(j=0;j<a-1;j++)
		{
			c=j;
			for(k=j+1;k<a;k++)
			{
				if(b[k]<b[j])
					c=k;
			}
			t=b[c];
			b[c]=b[j];
			b[j]=t;
		}
		for(j=1,max=b[0]*a;j<a;j++)
			if((c=b[j]*(--a))>max)
				max=c;
		printf("%d\n",max);
	}
}

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