首页 > 其他分享 >abc050d <???>

abc050d <???>

时间:2023-06-21 09:44:42浏览次数:33  
标签:return LL long mp include abc050d mod

#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
typedef long long LL;
map<LL, LL> mp;
const LL mod = 1e9 + 7;

LL f(LL n)
{
    if (mp[n]) return mp[n];
    if (n & 1)
    {
        return mp[n] = (f(n / 2) * 2  + f(n / 2 - 1)) % mod;
    }
    else
    {
        return mp[n] = (f(n / 2) + f(n / 2 - 1) * 2) % mod;
    }
}

void solv()
{
    mp[0] = 1;
    mp[1] = 2;
    LL n;
    cin >> n;
    cout << f(n) << endl;
}

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int T = 1;
    // cin >> T;
    while (T --)
    {
        solv();
    }
    return 0;
}

标签:return,LL,long,mp,include,abc050d,mod
From: https://www.cnblogs.com/o2iginal/p/17495472.html

相关文章