#include<fstream>
using namespace std;
ifstream fin("generare.in");
ofstream fout("generare.out");
int a[21][1000],n,i,j,k,c,p;
int main()
{
fin>>n;
a[1][1]=1;
for(i=2;i<=n;i++)
{
j=1;k=0;
do
{
p=0;
c=a[i-1][j];
while(a[i-1][j]==c && a[i-1][j]!=0)
{
j++; p++;
}
k++;
a[i][k]=c;
k++;
a[i][k]=p;
}
while(a[i-1][j]!=0);
}
j=1;
while(a[n][j]!=0) fout<<a[n][j++];
fin.close();
fout.close();
return 0;
}
|