結果

問題 No.1581 Multiple Sequence
ユーザー merom686merom686
提出日時 2021-07-02 22:19:10
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 1,118 bytes
コンパイル時間 3,022 ms
コンパイル使用メモリ 201,688 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 22:24:48
合計ジャッジ時間 4,517 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 67 ms
4,376 KB
testcase_03 AC 74 ms
4,380 KB
testcase_04 AC 18 ms
4,376 KB
testcase_05 AC 78 ms
4,380 KB
testcase_06 AC 32 ms
4,376 KB
testcase_07 AC 17 ms
4,376 KB
testcase_08 AC 23 ms
4,376 KB
testcase_09 AC 69 ms
4,376 KB
testcase_10 AC 43 ms
4,380 KB
testcase_11 AC 8 ms
4,380 KB
testcase_12 AC 26 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 75 ms
4,376 KB
testcase_15 AC 51 ms
4,380 KB
testcase_16 AC 11 ms
4,376 KB
testcase_17 AC 84 ms
4,376 KB
testcase_18 AC 7 ms
4,376 KB
testcase_19 AC 63 ms
4,376 KB
testcase_20 AC 67 ms
4,376 KB
testcase_21 AC 74 ms
4,376 KB
testcase_22 AC 38 ms
4,376 KB
testcase_23 AC 86 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using mint = atcoder::modint1000000007;
using namespace std;
using ll = long long;

//int c = 0;
//vector<int> a;
//
//void dfs(int x, int s) {
//    if (s == 0) {
//        int n = a.size();
//        for (int i = 0; i < n; i++) {
//            cout << a[i] << " \n"[i == n - 1];
//        }
//        c++;
//        return;
//    }
//    int t = 0;
//    for (int i = 1;; i++) {
//        t += x;
//        s -= x;
//        if (s < 0) break;
//        if (s % t == 0) {
//            a.push_back(t);
//            dfs(t, s);
//            a.pop_back();
//        }
//    }
//}

int main() {
    //dfs(1, 12);
    //cout << c << endl;

    int m;
    cin >> m;

    vector<mint> dp(m + 1);
    dp[0] = 1;
    dp[1] = 1;
    for (int i = 2; i <= m; i++) {
        mint t = 0;
        for (int j = 1; j * j <= i; j++) {
            if (i % j == 0) {
                int k = i / j;
                t += dp[(i - j) / j];
                if (j != k) t += dp[(i - k) / k];
            }
        }
        dp[i] = t;
    }
    cout << dp[m].val() << endl;

    return 0;
}
0