Coodechef Bytelandian gold coins solution
Solution in C++:
///**********ALLAH IS ALMIGHTY************///
///AH Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
map<ll,ll>mp;
ll result(ll n)
{
if(n==0||n==1)
return n;
if(mp[n]!=0)
return mp[n];
else
{
ll s=max(n,result(n/2)+result(n/3)+result(n/4));
mp[n]=s;
return mp[n];
}
}
int main()
{
ll n,c,a;
while(cin>>n)
{
cout<<result(n)<<endl;
}
}
///**********ALLAH IS ALMIGHTY************///
///AH Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
map<ll,ll>mp;
ll result(ll n)
{
if(n==0||n==1)
return n;
if(mp[n]!=0)
return mp[n];
else
{
ll s=max(n,result(n/2)+result(n/3)+result(n/4));
mp[n]=s;
return mp[n];
}
}
int main()
{
ll n,c,a;
while(cin>>n)
{
cout<<result(n)<<endl;
}
}
This blog website is pretty cool! How was it made !
ReplyDeleteTafelgeschäft Kassel
Excellent website you have here, so much cool information!..
ReplyDeleteKassel Tafelgeschäft
Thank you brother.
DeleteShare great information about your blog , Blog really helpful for us . We read your blog , share most useful information in blog . Thanks for share your blog here .Trump MAGA Victory Coin
ReplyDeleteSuperbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. gold ira companies compared
ReplyDeleteThank you brother
Delete