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

这题数据弱,蒙过了第50题!!汗AC

Posted by nixnus at 2008-07-04 22:26:22 on Problem 2291
#include<stdio.h>
#include"stdlib.h"
void main()
{    int cmp(const void *x,const void *y);
int n,i,a[10000],max,t ;
 scanf("%d",&t);

 while(t--)
{  max=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{ scanf("%d",&a[i]);
}
  qsort(a,n,sizeof(a[0]),cmp);
  for(i=0;i<n;i++)
  if(max<a[i]*(n-i))
  max= a[i]*(n-i);
    printf("%d\n",max);
    }


}
int cmp(const void *x,const void *y)
{
    return *(int *) x - *(int *) y;
}

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