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;
    }

}

6 comments:

  1. This blog website is pretty cool! How was it made !
    Tafelgeschäft Kassel

    ReplyDelete
  2. Excellent website you have here, so much cool information!..
    Kassel Tafelgeschäft

    ReplyDelete
  3. Share 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

    ReplyDelete
  4. Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. gold ira companies compared

    ReplyDelete

Most View Post

Recent post

Codeforces Round 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.