#include<bits/stdc++.h>
using namespace std;
int main()
{
long int t,l;
cin>>t;
int i;
vector<int>k;
vector<int>::iterator it;
it=k.begin();
for(i=0;i<t;i++)
{
cin>>l;
k.push_back(l);
}
sort(k.begin(),k.end());
long int a=k.size();
for(i=0;i<a;i++)
{
k[i]=k[i]*(a-i);
}
long int s=*max_element(k.begin(),k.end());
cout<<s<<endl;
}
Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile!
Try To Format Your Code Like This So That It Is Easy To Read
Its Easy Just Surround Your Code With These ``` At Start And At End
#include<bits/stdc++.h>
using namespace std;
int main()
{
long int t,l;
cin>>t;
int i;
vectork;
vector::iterator it;
it=k.begin();
for(i=0;i<t;i++)
{
cin>>l;
k.push_back(l);
}
sort(k.begin(),k.end());
long int a=k.size();
for(i=0;i<a;i++)
{
k[i]=k[i]*(a-i);
}
long int s=*max_element(k.begin(),k.end());
cout<<s<<endl;
}