結果

問題 No.1581 Multiple Sequence
ユーザー rtyurtyu
提出日時 2021-07-08 11:54:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 595 bytes
コンパイル時間 571 ms
コンパイル使用メモリ 76,792 KB
実行使用メモリ 14,732 KB
最終ジャッジ日時 2023-09-14 04:46:03
合計ジャッジ時間 2,394 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,700 KB
testcase_01 AC 3 ms
5,692 KB
testcase_02 AC 60 ms
13,004 KB
testcase_03 AC 65 ms
13,536 KB
testcase_04 AC 19 ms
8,280 KB
testcase_05 AC 61 ms
13,924 KB
testcase_06 AC 27 ms
9,808 KB
testcase_07 AC 18 ms
8,176 KB
testcase_08 AC 21 ms
9,008 KB
testcase_09 AC 53 ms
13,164 KB
testcase_10 AC 36 ms
11,036 KB
testcase_11 AC 10 ms
7,076 KB
testcase_12 AC 24 ms
9,232 KB
testcase_13 AC 4 ms
5,952 KB
testcase_14 AC 58 ms
13,600 KB
testcase_15 AC 40 ms
11,708 KB
testcase_16 AC 11 ms
7,412 KB
testcase_17 AC 63 ms
14,312 KB
testcase_18 AC 9 ms
6,900 KB
testcase_19 AC 51 ms
12,884 KB
testcase_20 AC 56 ms
13,080 KB
testcase_21 AC 58 ms
13,528 KB
testcase_22 AC 33 ms
10,544 KB
testcase_23 AC 69 ms
14,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;

long long md = 1000000007;
long long d[100009];
vector<int> v[100009];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    for (int i = 1; i <= n; i++)
        for (int j = i; j <= n; j += i)
            v[j].push_back(i);
    d[0] = d[1] = 1;
    for (int i = 2; i <= n; i++) {
        for (int j = 0; j < v[i].size(); j++) {
            int p = v[i][j];
            d[i] = (d[i] + d[(i - p) / p]) % md;
        }
    }
    cout << d[n] << '\n';
    return 0;
}
0