• E. Count The Blocks


    You wrote down all integers from 00 to 10n110n−1, padding them with leading zeroes so their lengths are exactly nn. For example, if n=3n=3 then you wrote out 000, 001, ..., 998, 999.

    A block in an integer xx is a consecutive segment of equal digits that cannot be extended to the left or to the right.

    For example, in the integer 0002773400000027734000 there are three blocks of length 11, one block of length 22 and two blocks of length 33.

    For all integers ii from 11 to nn count the number of blocks of length ii among the written down integers.

    Since these integers may be too large, print them modulo 998244353998244353.

    Input

    The only line contains one integer nn (1n21051≤n≤2⋅105).

    Output

    In the only line print nn integers. The ii-th integer is equal to the number of blocks of length ii.

    Since these integers may be too large, print them modulo 998244353998244353.

    Examples
    input
    Copy
    1
    
    output
    Copy
    10
    
    input
    Copy
    2
    
    output
    Copy
    180 10
    
    #include <iostream>
    #include <vector>
    #include <algorithm>
    #include <string>
    #include <set>
    #include <queue>
    #include <map>
    #include <sstream>
    #include <cstdio>
    #include <cstring>
    #include <numeric>
    #include <cmath>
    #include <iomanip>
    #include <deque>
    #include <bitset>
    //#include <unordered_set>
    //#include <unordered_map>
    #define ll              long long
    #define pii             pair<int, int>
    #define rep(i,a,b)      for(ll  i=a;i<=b;i++)
    #define dec(i,a,b)      for(ll  i=a;i>=b;i--)
    #define forn(i, n)      for(ll i = 0; i < int(n); i++)
    using namespace std;
    int dir[4][2] = { { 1,0 },{ 0,1 } ,{ 0,-1 },{ -1,0 } };
    const long long INF = 0x7f7f7f7f7f7f7f7f;
    const int inf = 0x3f3f3f3f;
    const double pi = 3.14159265358979323846;
    const double eps = 1e-6;
    const int mod = 998244353;
    const int N = 2e5 + 5;
    //if(x<0 || x>=r || y<0 || y>=c)
    
    inline ll read()
    {
        ll x = 0; bool f = true; char c = getchar();
        while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
        while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
        return f ? x : -x;
    }
    ll gcd(ll m, ll n)
    {
        return n == 0 ? m : gcd(n, m % n);
    }
    ll lcm(ll m, ll n)
    {
        return m * n / gcd(m, n);
    }
    bool prime(int x) {
        if (x < 2) return false;
        for (int i = 2; i * i <= x; ++i) {
            if (x % i == 0) return false;
        }
        return true;
    }
    inline int qpow(int x, ll n) {
        int r = 1;
        while (n > 0) {
            if (n & 1) r = 1ll * r * x % mod;
            n >>= 1; x = 1ll * x * x % mod;
        }
        return r;
    }
    inline int add(int x, int y) {
        return ((x%mod)+(y%mod))%mod;
    }
    inline int sub(int x, int y) {
        x -= y;
        return x < 0 ? x += mod : x;
    }
    inline int mul(int x, int y) {
        return (1ll * (x %mod) * (y % mod))%mod;
    }
    
    inline int Inv(int x) {
        return qpow(x, mod - 2);
    }
    
    int main()
    {
        ll n;
        cin >> n;
        vector<ll> f(n + 1,1);
        rep(i, 1, n)
            f[i] = f[i - 1] * 10 % mod;
        rep(i, 1, n)
        {
            if (i == n)
                cout << 10 << endl;
            else
            {
                ll t1 = n - i - 1, t2 = 2;
                t1 = mul(f[n - i - 1], t1) * 81ll % mod;
                t2 = mul(f[n - i], 18);
                cout << add(t1, t2) << " ";
            }
        }
        return 0;
    }
  • 相关阅读:
    css3 box-shadow属性 鼠标移动添加阴影效果
    从客户端(txtContent="<p>1</p>")中检测到有潜在危险的 Request.Form 值
    JS 点击按钮后弹出遮罩层,有关闭按钮
    htm5 手机自适应问题 文本框被激活(获取焦点)时,页面会放大至原来尺寸。
    !important 语法
    如何控制table中td内的文本位置
    点击超链接不跳转,不刷新页面
    学以致用三十二-----python中函数的括号使用
    学以致用三十一-----IPAddressField has been removed
    学以致用三十-----pycharm创建django项目忘记添加app
  • 原文地址:https://www.cnblogs.com/dealer/p/13234633.html
Copyright © 2020-2023  润新知