結果

問題 No.639 An Ordinary Sequence
ユーザー tetsuzuki1115
提出日時 2018-01-27 04:15:31
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 11 ms / 1,000 ms
コード長 679 bytes
コンパイル時間 756 ms
コンパイル使用メモリ 83,040 KB
実行使用メモリ 7,532 KB
最終ジャッジ日時 2025-01-02 02:13:52
合計ジャッジ時間 1,700 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int M[1000000] = {0};

long long func( long long i ) {
    
    if ( i < 1000000 ) { return M[i]; }
    
    long long a = func( i/3 ) + func( i/5 );
    
    return a;
}


int main() {
        
    long long N;
    cin >> N;
    
    M[0] = 1;
    for ( int i = 1; i < 1000000; i++ ) {
        M[i] = M[i/3] + M[i/5];
    }
    
    cout << func(N) << endl;
    
    
    
    return 0;
}
0