結果

問題 No.1581 Multiple Sequence
ユーザー kiyoshi0205kiyoshi0205
提出日時 2021-07-02 22:06:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 3,577 ms
コンパイル使用メモリ 227,172 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 22:02:12
合計ジャッジ時間 5,664 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 63 ms
4,376 KB
testcase_03 AC 70 ms
4,380 KB
testcase_04 AC 16 ms
4,376 KB
testcase_05 AC 73 ms
4,380 KB
testcase_06 AC 30 ms
4,380 KB
testcase_07 AC 16 ms
4,380 KB
testcase_08 AC 22 ms
4,380 KB
testcase_09 AC 65 ms
4,376 KB
testcase_10 AC 40 ms
4,376 KB
testcase_11 AC 8 ms
4,376 KB
testcase_12 AC 24 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 70 ms
4,376 KB
testcase_15 AC 48 ms
4,376 KB
testcase_16 AC 10 ms
4,376 KB
testcase_17 AC 79 ms
4,376 KB
testcase_18 AC 7 ms
4,380 KB
testcase_19 AC 60 ms
4,376 KB
testcase_20 AC 63 ms
4,376 KB
testcase_21 AC 70 ms
4,380 KB
testcase_22 AC 36 ms
4,376 KB
testcase_23 AC 81 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using mint=modint1000000007;
using ll=long long;
#define rep(i,N) for(int i=0;i<N;++i)
ll N;
mint dp[100001];
int main(){
  cin>>N;
  dp[0]=dp[1]=1;
  for(int i=2;i<=N;++i){
    int j;
    for(j=1;j*j<i;++j){
      if(i%j)continue;
      dp[i]+=dp[i/j-1]+dp[j-1];
    }
    if(j*j==i)dp[i]+=dp[j-1];
  }
  cout<<dp[N].val()<<endl;
}
0