| 比赛 | 
    NOIP2023模拟赛5 | 
    评测结果 | 
    AAAAAAAAAA | 
    | 题目名称 | 
    数列 | 
    最终得分 | 
    100 | 
    | 用户昵称 | 
    小金 | 
    运行时间 | 
    0.000 s  | 
    | 代码语言 | 
    C++ | 
    内存使用 | 
    0.00 MiB  | 
    | 提交时间 | 
    2023-11-17 12:41:15 | 
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
int a[30][100010],n,tot;
void chu(int x)
{
	int t,p;
	tot=0;
	for(int i=1;i<=a[x][0];i++)
	{
		t=1;
		p=a[x][i];
		for(int j=i+1;;j++)
		{
			if(a[x][j]!=p)
			{
				tot++;
				a[x+1][tot]=t;
				tot++;
				a[x+1][tot]=p;
				i=j-1;
				break;
			}
			t++;
		}
	}
	a[x+1][0]=tot;
}
int main()
{
	freopen("jzoi2022_sequence.in","r",stdin);
    freopen("jzoi2022_sequence.out","w",stdout);
	cin>>n;
	a[1][0]=1;
	a[1][1]=1;
	for(int i=2;i<=n;i++)
	{
		chu(i-1);
	}
	for(int i=1;i<=a[n][0];i++)
	{
		cout<<a[n][i];
	}
	return 0;
}