My solution : CodeChef: Practical coding for everyone
The link to question is CodeChef: Practical coding for everyone
My solution : CodeChef: Practical coding for everyone
The link to question is CodeChef: Practical coding for everyone
Let us consider the following scenario when the input is
1
2 5 3 2
1 6
Over here, the best solution would be to go from 3 to 6, then change and then go from 6 to 5 which would take a total time of 6 minutes. But the output of your solution is 8. Try debugging it. Thanks.
Thank you!!
got my logical error …i was optimizing the nearest floor but was missing the part of Alice’s floor
WHY DID THIS SOLUTION FOR CodeChef: Practical coding for everyone GET WA ?
#include
using namespace std;
int main() {
int t;
cin>>t;
while(t–)
{
int n,maxi=0;
cin>>n;
while(n–) {
int s,v,p,x;
cin>>s>>v>>p;
x=(p/(s+1))*v;
if(x>maxi)
maxi=x;
}
cout<<maxi<<endl;
}
return 0;
}
cin >> s >> p >> v;
Overlooked the Input section My bad. Thanks !