• CF1327E Count The Blocks


    原题链接

    • 题意:求出在从 (1)(10^n-1) 的范围所有数,有多少连续的 (i) 位相同的段个数。
    • 题解:就计数一下,首先是边缘然后是放中间。
    • 代码:
    #include <iostream>
    #include <algorithm>
    #include <cmath>
    #include <cstring>
    #include <vector>
    #include <map>
    #include <unordered_map>
    #include <cstring>
    using namespace std;
    #define ___ long long  
    const ___ N = 2e7 + 9;
    const ___ mod = 998244353;
    const ___ P = 13331;
    ___ cnt[N];
    ___ q_mi(___ xx, ___ k) {
        ___ ret = 1;
        ___ x = xx;
        while (k) {
            if (k & 1)(ret *= x)%=mod;
            //cout << k << endl;
            k >>= 1;
            (x *= x)%=mod;
        }
        return ret;
    }
    void solve() {
        ___ n;cin >> n;
        ___ ans = 0;
        int x = 10000;
        int xxx = 10, ttt = 10;
        while (x--)xxx += ttt;
        for (int i = 1; i <= n; i ++) {
            if (i == n){cout << 10 << endl;break;}
            ans = 9 * 10 * q_mi(10, n-1-i)%mod * 2%mod;
            if (n-2-i >= 0) {
                ans +=  9 * 9 * 10 * (q_mi(10, n-2-i))%mod * (n-i-1)%mod;
                ans %= mod;
            }
            cout << ans << " ";
            
        }
    }
    signed main() {
        ___ t= 1;//cin >> t;
        //ios::sync_with_stdio(0);
        while (t--) {
            solve();
        }
    }
    
  • 相关阅读:
    流量数据iftop命令
    DNS A记录和CNAME记录
    centos6.5安装mysql
    Python列表插入字典(转)
    列表转字典
    python 二分法O(logn)
    centos 6.5搭建Samba
    反爬虫-----看这一篇就够了
    windows常用命令
    requests中文页面乱码解决方案【转】
  • 原文地址:https://www.cnblogs.com/Xiao-yan/p/14778282.html
Copyright © 2020-2023  润新知