結果

問題 No.639 An Ordinary Sequence
ユーザー au7777
提出日時 2022-07-28 15:42:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 295 bytes
コンパイル時間 1,539 ms
コンパイル使用メモリ 172,576 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-18 06:32:59
合計ジャッジ時間 2,153 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
map<ll, ll> mp;
ll f(ll x) {
    if (mp[x]) return mp[x];
    if (x == 0) return 1;
    ll ret = f(x / 3) + f(x / 5);
    mp[x] = ret;
    return ret;
}
int main() {
    ll n;
    cin >> n;
    cout << f(n);
    return 0;
}
0