結果

問題 No.639 An Ordinary Sequence
ユーザー tetsuzuki1115tetsuzuki1115
提出日時 2018-01-27 04:15:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 16 ms / 1,000 ms
コード長 679 bytes
コンパイル時間 1,630 ms
コンパイル使用メモリ 73,156 KB
実行使用メモリ 7,540 KB
最終ジャッジ日時 2023-08-30 12:52:23
合計ジャッジ時間 2,420 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,540 KB
testcase_01 AC 15 ms
7,236 KB
testcase_02 AC 6 ms
7,236 KB
testcase_03 AC 7 ms
7,288 KB
testcase_04 AC 7 ms
7,440 KB
testcase_05 AC 7 ms
7,300 KB
testcase_06 AC 6 ms
7,240 KB
testcase_07 AC 6 ms
7,532 KB
testcase_08 AC 7 ms
7,240 KB
testcase_09 AC 7 ms
7,244 KB
testcase_10 AC 6 ms
7,308 KB
testcase_11 AC 6 ms
7,440 KB
testcase_12 AC 7 ms
7,532 KB
testcase_13 AC 7 ms
7,216 KB
testcase_14 AC 7 ms
7,240 KB
testcase_15 AC 9 ms
7,240 KB
testcase_16 AC 16 ms
7,228 KB
testcase_17 AC 6 ms
7,248 KB
testcase_18 AC 15 ms
7,284 KB
権限があれば一括ダウンロードができます

ソースコード

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