結果

問題 No.1581 Multiple Sequence
ユーザー 37zigen
提出日時 2021-07-03 03:43:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 459 bytes
コンパイル時間 644 ms
コンパイル使用メモリ 61,632 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-29 21:51:26
合計ジャッジ時間 1,623 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other WA * 21
権限があれば一括ダウンロードができます

ソースコード

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