結果

問題 No.1581 Multiple Sequence
ユーザー umezo
提出日時 2021-07-02 23:29:57
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 308 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 1,831 ms
コンパイル使用メモリ 200,148 KB
最終ジャッジ日時 2025-01-22 16:57:35
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

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