結果

問題 No.1581 Multiple Sequence
ユーザー otoshigootoshigo
提出日時 2023-02-23 13:31:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 841 bytes
コンパイル時間 575 ms
コンパイル使用メモリ 73,188 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-30 16:08:00
合計ジャッジ時間 2,865 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 61 ms
4,376 KB
testcase_03 AC 70 ms
4,376 KB
testcase_04 AC 17 ms
4,380 KB
testcase_05 AC 72 ms
4,376 KB
testcase_06 AC 30 ms
4,376 KB
testcase_07 AC 15 ms
4,380 KB
testcase_08 AC 21 ms
4,376 KB
testcase_09 AC 64 ms
4,380 KB
testcase_10 AC 40 ms
4,376 KB
testcase_11 AC 8 ms
4,376 KB
testcase_12 AC 24 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 69 ms
4,376 KB
testcase_15 AC 47 ms
4,380 KB
testcase_16 AC 10 ms
4,376 KB
testcase_17 AC 77 ms
4,376 KB
testcase_18 AC 7 ms
4,380 KB
testcase_19 AC 59 ms
4,376 KB
testcase_20 AC 62 ms
4,380 KB
testcase_21 AC 68 ms
4,376 KB
testcase_22 AC 36 ms
4,380 KB
testcase_23 AC 80 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

const ll MOD=1e9+7;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int M;
    cin>>M;
    vector<ll>dp(M+1);
    for(int i=1;i<=M;i++){
        dp[i]=1;
        int b=1;
        while(b*b<=i){
            if(i%b==0){
                dp[i]+=dp[(i-b)/b];
                if(b*b<i)dp[i]+=dp[(i-(i/b))/(i/b)];
                dp[i]%=MOD;
            }
            b++;
        }
    }
    cout<<dp[M]<<"\n";
}
0