結果

問題 No.1581 Multiple Sequence
ユーザー magstamagsta
提出日時 2021-03-05 19:26:10
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 640 bytes
コンパイル時間 739 ms
コンパイル使用メモリ 85,852 KB
実行使用メモリ 71,632 KB
最終ジャッジ日時 2023-09-11 14:15:09
合計ジャッジ時間 3,783 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 126 ms
59,884 KB
testcase_03 AC 144 ms
64,300 KB
testcase_04 AC 37 ms
24,424 KB
testcase_05 AC 141 ms
66,760 KB
testcase_06 AC 65 ms
35,956 KB
testcase_07 AC 32 ms
23,324 KB
testcase_08 AC 47 ms
29,440 KB
testcase_09 AC 131 ms
61,636 KB
testcase_10 AC 85 ms
44,764 KB
testcase_11 AC 16 ms
14,972 KB
testcase_12 AC 48 ms
31,556 KB
testcase_13 AC 3 ms
4,968 KB
testcase_14 AC 133 ms
64,728 KB
testcase_15 AC 93 ms
50,180 KB
testcase_16 AC 19 ms
16,984 KB
testcase_17 AC 155 ms
70,192 KB
testcase_18 AC 13 ms
12,872 KB
testcase_19 AC 107 ms
58,256 KB
testcase_20 AC 117 ms
60,224 KB
testcase_21 AC 133 ms
64,180 KB
testcase_22 AC 73 ms
41,364 KB
testcase_23 AC 149 ms
71,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <vector>
using namespace std;
#define MOD 1000000007

int main() {
	long long M; cin >> M;
	long long dp[M];
	for (int i = 0; i < M; i++) dp[i] = 0;
	queue<long long> Que[M];
	for (int i = 0; i < M; i++) {
		dp[i] = 1;
		while (!Que[i].empty()) {
			long long a = Que[i].front();
			Que[i].pop();
			dp[i] += dp[(i + 1) / a - 2];
		}
		long long n = i + 1;
		while (n <= M) {
			Que[n - 1].push(i + 1);
			n += i + 1;
		}
		dp[i] %= MOD;
	}
	cout << dp[M - 1] << endl;
}
0