标签:
Description
Input
Output
Sample Input
2 3 10 1 15 2 10 15
Sample Output
20 20
Source
#include<cstdio> #include<algorithm> #include<cstring> using namespace std; bool cmp(int a,int b) { return a>b; } int a[1010]; int main() { int T; int n; scanf("%d",&T); while(T--){ scanf("%d",&n); for(int i = 1; i <= n ; i++){ scanf("%d",&a[i]); } sort(a+1,a+n+1,cmp); int max1 = 0; for(int i = 1 ; i <= n ; i++){ max1 = max(max1,a[i]*i); } printf("%d\n",max1); } return 0; }
标签:
原文地址:http://www.cnblogs.com/zero-begin/p/4561703.html