View Code of Problem 61

#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
	int t, n;
	int m[1000]={0};
	cin >> t;
	while(t != 0)
	{
		int max = 0;
		cin >> n;
		for(int i = 0; i < n ; i++)
			cin >> m[i];
		sort(m,m+n);
		for(int i = n-1; i >= 0; i--)
			if(m[i]*(n-i) > max)
				max = m[i]*(n-i);
		cout << max << endl;
		t--;
	}
	return 0;
}

/*
Main.c:1:9: fatal error: iostream: No such file or directory
 #include<iostream>
         ^~~~~~~~~~
compilation terminated.
*/

Double click to view unformatted code.


Back to problem 61