結果
| 問題 |
No.1755 Almost Palindrome
|
| コンテスト | |
| ユーザー |
あべし
|
| 提出日時 | 2021-11-20 19:06:06 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 123 ms / 2,000 ms |
| コード長 | 1,852 bytes |
| コンパイル時間 | 2,666 ms |
| コンパイル使用メモリ | 191,884 KB |
| 最終ジャッジ日時 | 2025-01-25 22:15:16 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 |
ソースコード
#include<bits/stdc++.h>
#define int ll
#define rep(i, N) for(int i = 0; i < (int)N; ++i)
#define rep1(i, N) for(int i = 1; i <= (int)N; ++i)
#define per(i, N) for(int i = N-1; i >= 0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define TakAo(ans) ans ? cout << "Takahashi\n" : cout << "Aoki\n"
#define YesNo(ans) ans ? cout << "Yes\n" : cout << "No\n"
#define yesno(ans) ans ? cout << "yes\n" : cout << "no\n"
#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define mkpr make_pair
#define mktpl make_tuple
using namespace std;
using ll = int64_t;
using ld = long double;
const ld EPS = 1e-8;
const ll INF = 1e9+10;
const int MOD = 998244353;
//const int MOD = 1e9+7;
const int NIL = -1;
ll cel(ll a, ll b){ return (a + b - 1) / b; }
ll Gcd(ll a, ll b){ return b ? Gcd(b, a % b) : a; }
ll Lcm(ll a, ll b){ return a / Gcd(a, b) * b; }
ll sq(ll a){ return a * a; }
template<class T> bool chmin(T &a, T b){ if(a > b){ a = b; return 1;} return 0; }
template<class T> bool chmax(T &a, T b){ if(a <= b){ a = b; return 1;} return 0; }
using P = pair<int, int>;
using Tpl = tuple<int, int, int>;
using vvec= vector<vector<int>>;
using vvvec = vector<vector<vector<int>>>;
ll modpow(ll x, ll exp, ll mod){
ll res = 1;
for(; exp > 0; exp >>= 1){
if(exp & 1) res = res * x % mod;
x = x * x % mod;
}
return res;
}
void Main(){
const int max_n = 1e6;
int T; cin >> T;
ll ans[max_n] = {0, 650,};
for(int i = 3; i <= max_n; ++i){
ll val = (2 * modpow(26, i / 2 - 1, MOD) - (i % 2 == 0) + MOD) % MOD;
ans[i-1] = 650 * val % MOD;
ans[i-1] = (ans[i-1] + 26 * ans[i-3]) % MOD;
}
while(T--){
int N; cin >> N;
cout << ans[N-1] << endl;
}
}
signed main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(15);
Main();
return 0;
}
あべし