C-被遗忘的书籍_牛客小白月赛82 (nowcoder.com)
#include <iostream>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;#define ll unsigned long long
#define INF 0x7fffffff
typedef pair<int, int> PII;ll arr[200005][3] = {0};
ll mod = 998244353;
ll poww(ll a, ll b) {ll ret = 1;while (b) {if (b & 1) ret = ret * a % mod;a = a * a % mod;b >>= 1;}return ret;
}
int main() {ll T, n;cin >> T;arr[1][0] = 1, arr[1][1] = 0, arr[1][2] = 25;for (int i = 2; i < 200005; i++) {// 0 t结尾 1 tx结尾 2其他字母结尾arr[i][0] = (arr[i - 1][2] + arr[i - 1][0]) % mod;arr[i][1] = arr[i - 1][0];arr[i][2] = (arr[i - 1][2] * 25 + arr[i - 1][1] * 25 + arr[i - 1][0] * 24) % mod;}while (T--) {cin >> n;cout << (poww(26, n) + 3 * mod - arr[n][0] - arr[n][1] - arr[n][2]) % mod << endl;}return 0;
}