結果
| 問題 | No.2131 Concon Substrings (COuNt Version) |
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2022-11-26 14:36:50 |
| 言語 | C++17(clang) (clang++ 22.1.2 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 2,000 ms |
| コード長 | 771 bytes |
| 記録 | |
| コンパイル時間 | 4,618 ms |
| コンパイル使用メモリ | 147,840 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-19 01:34:21 |
| 合計ジャッジ時間 | 5,917 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
コンパイルメッセージ
main.cpp:22:9: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
22 | ll dp[N + 1];
| ^~~~~
main.cpp:22:9: note: read of non-const variable 'N' is not allowed in a constant expression
main.cpp:19:7: note: declared here
19 | int N;
| ^
1 warning generated.
ソースコード
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <climits>
#include <map>
#include <queue>
#include <set>
#include <cstring>
#include <vector>
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
int main() {
int N;
cin >> N;
ll dp[N + 1];
memset(dp, 0, sizeof(dp));
dp[0] = 1;
for (int i = 0; i < N; ++i) {
for (int j = N; j >= 0; --j) {
if (j < N) {
dp[j + 1] += dp[j];
dp[j + 1] %= MOD;
}
dp[j] *= 25;
dp[j] %= MOD;
}
}
ll ans = 0;
for (int i = 0; i <= N; ++i) {
ll cnt = i / 3;
// fprintf(stderr, "i: %d, cnt: %lld\n", i, dp[i]);
ans += cnt * dp[i];
ans %= MOD;
}
cout << ans << endl;
return 0;
}
siman