結果

問題 No.1581 Multiple Sequence
ユーザー umezoumezo
提出日時 2021-07-02 23:29:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 328 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 2,193 ms
コンパイル使用メモリ 206,196 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 23:56:21
合計ジャッジ時間 7,226 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 254 ms
4,380 KB
testcase_03 AC 281 ms
4,376 KB
testcase_04 AC 68 ms
4,376 KB
testcase_05 AC 296 ms
4,376 KB
testcase_06 AC 121 ms
4,376 KB
testcase_07 AC 65 ms
4,380 KB
testcase_08 AC 90 ms
4,376 KB
testcase_09 AC 264 ms
4,380 KB
testcase_10 AC 166 ms
4,380 KB
testcase_11 AC 31 ms
4,380 KB
testcase_12 AC 101 ms
4,376 KB
testcase_13 AC 4 ms
4,376 KB
testcase_14 AC 284 ms
4,380 KB
testcase_15 AC 197 ms
4,380 KB
testcase_16 AC 39 ms
4,376 KB
testcase_17 AC 317 ms
4,380 KB
testcase_18 AC 25 ms
4,376 KB
testcase_19 AC 245 ms
4,376 KB
testcase_20 AC 257 ms
4,380 KB
testcase_21 AC 279 ms
4,380 KB
testcase_22 AC 148 ms
4,376 KB
testcase_23 AC 328 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

const int MOD=1e9+7;
ll dp[100010];

vector<ll> divisor(ll x){
  set<ll> s;
  for(ll i=1;i*i<=x;i++){
    if(x%i==0){
      s.insert(i);
      s.insert(x/i);
    }
  }
  vector<ll> res;
  for(auto y:s) res.push_back(y);
  return res;
}

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  ll m;
  cin>>m;
  
  dp[0]=1;
  for(int i=1;i<=m;i++){
    vector<ll> A=divisor(i);
    for(auto x:A){
      dp[i]=(dp[i]+dp[i/x-1])%MOD;
    }
  }
  cout<<dp[m]<<endl;
  
  return 0;
}
0