結果

問題 No.1581 Multiple Sequence
ユーザー OmameBeansOmameBeans
提出日時 2021-07-06 16:29:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 1,192 bytes
コンパイル時間 1,531 ms
コンパイル使用メモリ 171,800 KB
実行使用メモリ 11,084 KB
最終ジャッジ日時 2023-09-14 04:23:45
合計ジャッジ時間 3,952 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
10,764 KB
testcase_01 AC 4 ms
10,804 KB
testcase_02 AC 93 ms
10,716 KB
testcase_03 AC 103 ms
10,876 KB
testcase_04 AC 27 ms
10,884 KB
testcase_05 AC 109 ms
10,760 KB
testcase_06 AC 47 ms
10,884 KB
testcase_07 AC 28 ms
10,784 KB
testcase_08 AC 36 ms
11,084 KB
testcase_09 AC 96 ms
10,744 KB
testcase_10 AC 62 ms
10,760 KB
testcase_11 AC 15 ms
10,792 KB
testcase_12 AC 40 ms
10,820 KB
testcase_13 AC 5 ms
10,712 KB
testcase_14 AC 104 ms
10,880 KB
testcase_15 AC 73 ms
10,884 KB
testcase_16 AC 18 ms
10,768 KB
testcase_17 AC 115 ms
10,756 KB
testcase_18 AC 13 ms
10,796 KB
testcase_19 AC 90 ms
10,896 KB
testcase_20 AC 94 ms
10,716 KB
testcase_21 AC 103 ms
10,788 KB
testcase_22 AC 57 ms
10,804 KB
testcase_23 AC 120 ms
10,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i = 0; i < (n); ++i)
#define DREP(i,s,n) for(int i = (s); i < (n); i++)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const int MOD = 1000000007;
const double pi = acos(-1);
ll gcd(ll a, ll b) {if(b == 0) return a; else return gcd(b,a%b);}
ll lcm(ll a, ll b) {return a*b/gcd(a,b);}

veci div(int N) {
    veci res;
    for(int i = 1; i*i <= N; i++) {
        if(N%i == 0) {
            res.push_back(i);
            if(i != N/i) res.push_back(N/i);
        }
    }
    sort(res.begin(),res.end());
    return res;
}

int main() {
    int M; cin >> M;
    vecl dp(1000010);
    dp[0] = 1;
    for(int i = 1; i <= M; i++) {
        for(auto j : div(i)) {
            dp[i] += dp[i/j-1];
            dp[i] %= MOD;
        }
    }
    cout << dp[M] << endl;
}
0