結果

問題 No.639 An Ordinary Sequence
ユーザー @abcde@abcde
提出日時 2020-03-13 22:04:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 12 ms / 1,000 ms
コード長 584 bytes
コンパイル時間 1,459 ms
コンパイル使用メモリ 164,448 KB
実行使用メモリ 11,564 KB
最終ジャッジ日時 2023-08-30 13:10:38
合計ジャッジ時間 2,529 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
11,548 KB
testcase_01 AC 12 ms
11,316 KB
testcase_02 AC 6 ms
11,272 KB
testcase_03 AC 6 ms
11,564 KB
testcase_04 AC 6 ms
11,288 KB
testcase_05 AC 6 ms
11,348 KB
testcase_06 AC 6 ms
11,292 KB
testcase_07 AC 6 ms
11,300 KB
testcase_08 AC 6 ms
11,352 KB
testcase_09 AC 6 ms
11,340 KB
testcase_10 AC 6 ms
11,416 KB
testcase_11 AC 6 ms
11,256 KB
testcase_12 AC 6 ms
11,324 KB
testcase_13 AC 6 ms
11,404 KB
testcase_14 AC 7 ms
11,256 KB
testcase_15 AC 9 ms
11,328 KB
testcase_16 AC 12 ms
11,316 KB
testcase_17 AC 7 ms
11,320 KB
testcase_18 AC 12 ms
11,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// ※※※ 解答不能 ※※※
// https://yukicoder.me/submissions/197554
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)

LL n, a[1000009];
LL solve(LL x){
    if(x <= 1000000) return a[x];
    return solve(x / 3) + solve(x / 5);
}
int main(){
    a[0] = 1;
    repx(i, 1, 1000001) a[i] = a[i / 3] + a[i / 5];
    scanf("%lld", &n);
    printf("%lld\n", solve(n));
    return 0;
}
0