My issue
how the revenue is calculated on the basis of budget. we does not given the price of smartphone
My code
#include <iostream>
using namespace std;
int main() {
int n;
int a,b,c,d;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d%d%d%d",&a,&b,&c,&d);
}
return 0;
}
Problem Link: CodeChef: Practical coding for everyone
@neeraj1305
plzz refer this solution for better understanding of the logic.
This is my c++ code but its easy to understand.
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
long long int n;
cin>>n;
long long int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
sort(a,a+n);
long long int mn=0;
for(int i=0;i<n;i++)
{
mn=max(mn,a[i]*(n-i));
}
cout<<mn<<endl;
return 0;
}