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 |
这题数据弱,蒙过了第50题!!汗AC#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator