結果

問題 No.1492 01文字列と転倒
ユーザー 夜
提出日時 2021-05-21 02:13:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 771 bytes
コンパイル時間 911 ms
コンパイル使用メモリ 92,932 KB
実行使用メモリ 410,624 KB
最終ジャッジ日時 2024-04-18 14:13:08
合計ジャッジ時間 9,807 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long dp[110][110][10110] = {};
int main() {
	long n, mod;
	cin >> n >> mod;
	dp[0][0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= i; j++) {
			for (int k = 0; k <= n * n; k++) {
				dp[i + 1][j][k + j] += dp[i][j][k];
				dp[i + 1][j][k + j] %= mod;
			}
		}
		for (int j = 1; j <= i + 1; j++) {
			for (int k = 0; k <= n * n; k++) {
				dp[i + 1][j][k] += dp[i + 1][j - 1][k];
			}
		}
	}
	for (int i = 0; i <= n * n; i++) {
		cout << dp[n][n - 1][i] << endl;
	}
}
0