| ||||||||||
| 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>
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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator