I am not able to understand this problem. explain me with examples.
Exchanging Coins Problem
you have to take the maximum value of two things here;
1)answer when you break it in coings of n/2,n/3,n/4
2)or simply sell it for a gold coin for n;
we are basically given a coin and we need to tell the max value if( we divide it by 2 , by 3 and by 4 ) or if simply use the coin value which is originally given to us
#include<bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin>>n;
cout<<max(((n / 2) + (n / 3) + (n + 4)), n);
return 0;
}
this is not working
constraints are large
u need to use DP
if no is not divisible by 2 or 3 or 4
then
floor value of the result
how to solve this problem
how to do this using for loop
no need to use for loop
this is the easiest and simplest way
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.