結果

問題 No.639 An Ordinary Sequence
ユーザー dnish
提出日時 2018-06-22 01:21:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 534 bytes
コンパイル時間 1,757 ms
コンパイル使用メモリ 170,248 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-01-02 02:30:20
合計ジャッジ時間 2,568 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define REP(i,n,N) for(ll i=(n); i<(N); i++)
#define RREP(i,n,N) for(ll i=(N-1); i>=n; i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define p(s) cout<<(s)<<endl
#define p2(a,b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod = 1e9+7;

unordered_map<ll,ll> dp;
ll f(ll n){
    if(dp.count(n)) return dp[n];
    return dp[n] = f(n/3) + f(n/5);
}

int main() {
    ll N;
    cin>>N;
    dp[0]=1;
    p(f(N));
}
0