結果

問題 No.1581 Multiple Sequence
ユーザー SSRSSSRS
提出日時 2021-03-06 17:46:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 1,659 ms
コンパイル使用メモリ 171,984 KB
実行使用メモリ 14,464 KB
最終ジャッジ日時 2024-06-29 04:32:45
合計ジャッジ時間 2,730 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 44 ms
12,288 KB
testcase_03 AC 47 ms
13,056 KB
testcase_04 AC 14 ms
6,528 KB
testcase_05 AC 49 ms
13,568 KB
testcase_06 AC 23 ms
8,448 KB
testcase_07 AC 13 ms
6,528 KB
testcase_08 AC 17 ms
7,296 KB
testcase_09 AC 44 ms
12,800 KB
testcase_10 AC 27 ms
9,856 KB
testcase_11 AC 7 ms
5,376 KB
testcase_12 AC 19 ms
7,680 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 47 ms
13,184 KB
testcase_15 AC 33 ms
10,880 KB
testcase_16 AC 9 ms
5,504 KB
testcase_17 AC 53 ms
14,080 KB
testcase_18 AC 6 ms
5,376 KB
testcase_19 AC 41 ms
12,160 KB
testcase_20 AC 43 ms
12,416 KB
testcase_21 AC 47 ms
13,184 KB
testcase_22 AC 26 ms
9,344 KB
testcase_23 AC 54 ms
14,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main(){
  int M;
  cin >> M;
  vector<vector<int>> f(M + 1);
  for (int i = 1; i <= M; i++){
    for (int j = i; j <= M; j += i){
      f[j].push_back(i);
    }
  }
  vector<long long> dp(M + 1);
  dp[0] = 1;
  for (int i = 1; i <= M; i++){
    for (int j : f[i]){
      dp[i] += dp[i / j - 1];
      if (dp[i] >= MOD){
        dp[i] -= MOD;
      }
    }
  }
  cout << dp[M] << endl;
}
0