My issue
explain me this problem more clearly with giving its solution
My code
# cook your dish here
Problem Link: CodeChef: Practical coding for everyone
explain me this problem more clearly with giving its solution
# cook your dish here
Problem Link: CodeChef: Practical coding for everyone
@ronit25
U have to maximize the revenue to can get my making a certain selling price for the mobile app.
and U can only buy if u have that much budget.
here is my c++ code for better understanding.
#include <iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin>>n;
long long int arr[1000000];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
sort(arr,arr+n);
long long int count=0;
long long int ans=0;
for(int i=0;i<n;i++)
{
count=arr[i]*(n-i);
ans=max(ans,count);
}
cout<<ans;
return 0;
}