210 lines
4.3 KiB
C++

/* Problem URL: https://codeforces.com/gym/106159/problem/A */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <class T, class comp = less<>>
using ordered_set = tree<T, null_type , comp , rb_tree_tag , tree_order_statistics_node_update>;
#define V vector
#define rmin(a, b) a = min(a, b)
#define rmax(a, b) a = max(a, b)
#define rep(i, lim) for (int i = 0; i < (lim); i++)
#define nrep(i, s, lim) for (int i = s; i < (lim); i++)
#define repv(i, v) for (auto &i : (v))
#define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; }
#define sortv(v) sort(v.begin(), v.end())
#define all(v) (v).begin(), (v).end()
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vvvvi = vector<vvvi>;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vvvvl = vector<vvvl>;
template<class v>
auto operator<<(ostream &os, const vector<v> &vec)->ostream& {
os << vec[0];
for (size_t i = 1; i < vec.size(); i++) {
os << ' ' << vec[i];
}
os << '\n';
return os;
}
template<class v>
auto operator>>(istream &is, vector<v> &vec)->istream& {
for (auto &i : vec) {
is >> i;
}
return is;
}
template<class v>
auto operator<<(ostream &os, const vector<vector<v>> &vec)->ostream& {
for (auto &i : vec) {
os << i[0];
for (size_t j = 1; j < i.size(); j++) {
os << ' ' << i[j];
}
os << '\n';
}
return os;
}
template<class v>
auto operator>>(istream &is, vector<vector<v>> &vec)->istream& {
for (auto &i : vec) {
for (auto &j : i) {
is >> j;
}
}
return is;
}
const int oo = INT32_MAX >> 1;
const ll OO = INT64_MAX >> 1;
void pre()
{
}
ll mod = 998244353;
#define TEST 0
void solve()
{
ll n, m;
cin >> n >> m;
string s;
cin >> s;
auto fpow = [&](ll a, ll p) {
ll ans = 1;
rep(i, 61) {
if ((p >> i) & 1) {
ans *= a;
ans %= mod;
}
a *= a;
a %= mod;
}
return ans;
};
// ll total = fpow(26, n - m) * (n - m + 1) % mod;
// // cout << fpow(26, n - m) * (n - m + 1) % mod << '\n';
// // cout << fpow(26, n - m) << '\n';
//
// nrep(i, 1, m - 1) {
// if (s.substr(i, m - 1) != s.substr(0, m - i)) {
// continue;
// }
//
// string tmp1 = s.substr(0, i);
// string tmp2 = s.substr(m - i);
// reverse(all(tmp2));
// if (tmp1 != tmp2) {
// continue;
// }
//
// int size = m + i;
// if (size > n) {
// break;
// }
//
// total -= fpow(26, n - size) * (n - size + 1) % mod;
// total += mod * (total < 0);
// }
//
// if (2 * m > n) {
// cout << total << '\n';
// return;
// }
//
// ll rem = fpow(26, n - m * 2);
//
//
// cout << total << '\n';
// ll total = fpow(26, n);
// rep(i, m) {
// ll now = fpow(26, i);
// ll cur = n - i;
//
// ll inv = (cur + m - 1) / m % mod;
// ll val = (cur / m * (m - 1) + max(cur % m - 1, 0LL)) % mod;
//
// total -= now * fpow(25, inv) % mod * fpow(26, val) % mod;
// total += mod * (total < 0);
// }
//
// cout << total << '\n';
vl fact(101);
fact[0] = 1;
nrep(i, 1, 101) {
fact[i] = (fact[i - 1] * i) % mod;
}
vl inv(101);
inv[0] = 1;
inv[1] = 1;
nrep(i, 2, 101) {
inv[i] = (mod - mod / i) * inv[mod % i] % mod;
}
nrep(i, 2, 101) {
inv[i] = (inv[i] * inv[i - 1]) % mod;
}
auto comb = [&](ll n, ll k) {
return fact[n] * inv[k] % mod * inv[n - k] % mod;
};
auto comb2 = [&](ll n, ll k) {
ll ans = n;
ll div = 1;
nrep(i, 2, k + 1) {
ans = (ans * (n - i + 1)) % mod;
div = (div * i) % mod;
}
return ans * fpow(div, mod - 2) % mod;
};
ll rem = 0;
ll cur = (n + m - 1) / m;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
pre();
int t;
(TEST && cin >> t) || (t = 1);
while (t--) {
solve();
}
}