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 |
水题专杀户的第25题..大神莫笑..#include <stdio.h> #include <stdlib.h> int cmp ( const void *a , const void *b ) { return *(int *)b - *(int *)a; } int main() { int a[1002],n,m,j,t,z; scanf("%d",&n); while(n--){ scanf("%d",&m); for (j=0;j<m;j++){ scanf("%d",&a[j]); } qsort(a,m,sizeof(a[0]),cmp); z = 0; for (j=1;j<=m;j++){ t = a[j-1]*j; if (z<t){ z = t; } } printf("%d\n",z); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator