• Noi 十连测 人生的经验


     SOL:

       那个,其实这道题爆搜能过。正解好像是建模后求欧拉回路。

      

      

    #pragma GCC optimize("-Ofast")
    #include<bits/stdc++.h>
    using namespace std;
    int len,c,l; int no;
    char ch[29];
    bool usd[11001009];
    unsigned char dla[11001009],now[11001009];
    #define sight(c) ('0'<=c&&c<='9')
    inline void read(int &x){
        static char c;
        for (c=getchar();!sight(c);c=getchar());
        for (x=0;sight(c);c=getchar())x=x*10+c-48;
    }
    int ple,pl,pll;
    inline bool tr(int x){
        if (x==c) return 0;
        return usd[no+x];
    }
    void sol(int c,int l){
        len=pow(c,l)+l-1; ple=pow(c,l); pl=pow(c,l-1); 
        usd[0]=1; //q[0]++; qq[0]++; qqq[0]++;
        for (int i=l+1;i<=len;i++,no=no*c-ple*now[i-l]) {
            now[i]=now[i]+dla[i]; dla[i]=0;
            while (tr(now[i])) now[i]++;
            if (now[i]>=c) {
              now[i]=0; 
              no=(no+ple*now[i-l])/c; i--;
              no=(no+ple*now[i-l])/c; i--;
    //          no=(no+ple*now[i-l]*c+ple*now[i-l-1])/(c*c); i-=2;
              usd[no*c-ple*now[i-l+1]+now[i+1]]=0; dla[i+1]++;
            } else {
            no+=now[i]; usd[no]=1;
            }
        }
    }
    signed main () {
        freopen("life.in","r",stdin);
        freopen("life.out","w",stdout);
        read(c); read(l);
        sol(c,l);
        scanf("%s",ch);
        printf("%d
    ",len);
        for (int i=1;i<=len;i++) putchar(ch[now[i]]);
        return 0;
    }
  • 相关阅读:
    MySQL-索引
    MySQL-存储引擎
    MySQL-基本概念
    Elasticsearch-分片原理2
    Elasticsearch-分片原理1
    [NOIP模拟33]反思+题解
    [NOIP模拟测试32]反思+题解
    [NOIP模拟测试31]题解
    [jzoj5840]Miner 题解(欧拉路)
    [NOIP模拟测试30]题解
  • 原文地址:https://www.cnblogs.com/rrsb/p/8666151.html
Copyright © 2020-2023  润新知