結果

問題 No.1581 Multiple Sequence
ユーザー 37zigen37zigen
提出日時 2021-07-03 03:43:47
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 459 bytes
コンパイル時間 1,190 ms
コンパイル使用メモリ 60,280 KB
実行使用メモリ 4,900 KB
最終ジャッジ日時 2023-09-12 09:07:14
合計ジャッジ時間 2,918 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<list>
typedef long long ll;

using namespace std;
const ll p = (ll) 1e9+7;

int main() {
		ll M;
		cin >> M;
		vector<ll> dp(M+1);
		dp[0]=1;
		for (int v=M;v>=1;--v) {
				vector<ll> sum(M/v+1);
				for (int j=0;j<=M/v;++j) {
						sum[j] = (j>0?sum[j-1]:0)+dp[j];
						sum[j] %= p;
				}
				for (int j=1;j<=M/v;++j) {
						dp[j*v] += sum[v==1?(j-1):j];
						dp[j*v] %= p;
				}
		}
		cout << dp[M] << endl;
}
0