比赛 NOIP2023模拟赛5 评测结果 AAAAAAAAAA
题目名称 数列 最终得分 100
用户昵称 op_组撒头屯 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2023-11-17 08:58:21
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define clr(f,n) memset(f,0,sizeof(int)*(n))
#define cpy(f,g,n) memcpy(f,g,sizeof(int)*(n))
const int N=(1<<25)+5;
const int M=1000+5;
int n;
int s[N],t[N],len[M]={1},num[M];
int main(){
	freopen ("jzoi2022_sequence.in","r",stdin);
	freopen ("jzoi2022_sequence.out","w",stdout);
    scanf("%d",&n);
    s[++len[1]]=1;
    for (int i=2;i<=n;i++){
        memset(num,0,sizeof(num));
        for (int j=1;j<=len[i-1];){
            int now=s[j],cnt=0;
            while(s[j]==now)j++,cnt++;
            t[++len[i]]=cnt;t[++len[i]]=now;
        }
        for (int j=1;j<=len[i];j++)s[j]=t[j];
    }
    for (int i=1;i<=len[n];i++)printf("%d",s[i]);
    return 0;
}