1 solutions

  • 0
    @ 2025-11-14 18:09:17

    image

    #include <bits/stdc++.h>
    using namespace std;
    #define int long long
    #define endl '\n'
    const int N = 1e5 + 10;
    const int mod = 998244353;
    
    //快速幂
    int power(int x, int p)
    {
        int ans = 1;
        x %= mod;
        while (p > 0)
        {
            if (p & 1)
                ans = ans * x % mod;
            x = x * x % mod;
            p >>= 1;
        }
        return ans;
    }
    
    int n, m;
    void info()
    {
        cin >> n >> m;
    
        int ans2 = 0;
        for (int i = 0; i <= m; i++)
        {
            int inv_26 = power(power(26, i), mod - 2);
            ans2 = (ans2 + ((1 - power((1 - inv_26 + mod) % mod, n) + mod) % mod) * power(26, i)) % mod;
        }
        cout << ans2 << endl;
    }
    
    signed main()
    {
        auto begin = chrono::high_resolution_clock::now();
        ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    #ifdef LOCAL
        freopen("in.in", "r", stdin);
        freopen("out.out", "w", stdout);
    #endif
        info();
    
    }
    
    

    Information

    ID
    7100
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    10
    Tags
    # Submissions
    3
    Accepted
    1
    Uploaded By