#abc247c. C - 1 2 1 3 1 2 1

C - 1 2 1 3 1 2 1

Score : 300300 points

问题描述

我们按以下方式定义序列 SnS_n

  • S1S_1 是一个长度为 11 的序列,仅包含一个数字 11
  • nn(一个大于等于 22 的整数)时,SnS_n 是通过按照顺序连接 Sn1S_{n-1}nnSn1S_{n-1} 获得的序列。

例如,以下是 S2S_2S3S_3 的定义:

  • S2S_2 是按照 S1S_122S1S_1 的顺序拼接而成,因此它是 1,2,11,2,1
  • S3S_3 是按照 S2S_233S2S_2 的顺序拼接而成,因此它是 1,2,1,3,1,2,11,2,1,3,1,2,1

给定 NN,请打印整个序列 SNS_N

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

We define sequences SnS_n as follows.

  • S1S_1 is a sequence of length 11 containing a single 11.
  • SnS_n (nn is an integer greater than or equal to 22) is a sequence obtained by concatenating Sn1S_{n-1}, nn, Sn1S_{n-1} in this order.

For example, S2S_2 and S3S_3 is defined as follows.

  • S2S_2 is a concatenation of S1S_1, 22, and S1S_1, in this order, so it is 1,2,11,2,1.
  • S3S_3 is a concatenation of S2S_2, 33, and S2S_2, in this order, so it is 1,2,1,3,1,2,11,2,1,3,1,2,1.

Given NN, print the entire sequence SNS_N.

Constraints

  • NN is an integer.
  • 1N161 \leq N \leq 16

Input

Input is given from Standard Input in the following format:

NN

Output

Print SNS_N, with spaces in between.

Sample Input 1

2

Sample Output 1

1 2 1

As described in the Problem Statement, S2S_2 is 1,2,11,2,1.

Sample Input 2

1

Sample Output 2

1

Sample Input 3

4

Sample Output 3

1 2 1 3 1 2 1 4 1 2 1 3 1 2 1
  • S4S_4 is a concatenation of S3S_3, 44, and S3S_3, in this order.

update @ 2024/3/10 10:35:36