简单数列

Luogu
IDLGP8248
Time1000ms
Memory128MB
DifficultyP3
Special Judge
给你一个数 $n$,你需要求出一个长度为 $n$ 的数组 $a$,(下标从 $1$ 开始,且元素都为 $1,2,3$ 或 $4$),使得: * 对于第 $i$ 个数,对于所有的 $1 \le len \le \lfloor\frac{i}{2}\rfloor$, $a_{i-len+1\dots i}$ 与 $a_{i-len\times2+1\dots i-len}$ 不相同。($\lfloor x \rfloor$ 表示对 $x$ 下取整) * 说人话,就是没有任何连续的连续子串相同。 ## Input 一行一个正整数 $n$。 ## Output 一行,$n$ 个正整数,数组 $a$。 [samples] ## Note 对于 $20\%$ 的数据,满足 $1 \le n \le 10$; 对于 $40\%$ 的数据,满足 $1 \le n \le 30$; 对于 $100\%$ 的数据,满足 $1 \le n \le 500$。
Samples
Input #1
3
Output #1
1 2 3
Input #2
6
Output #2
1 2 3 4 1 3
API Response (JSON)
{
  "problem": {
    "name": "简单数列",
    "description": {
      "content": "给你一个数 $n$,你需要求出一个长度为 $n$ 的数组 $a$,(下标从 $1$ 开始,且元素都为 $1,2,3$ 或 $4$),使得: * 对于第 $i$ 个数,对于所有的 $1 \\le len \\le \\lfloor\\frac{i}{2}\\rfloor$, $a_{i-len+1\\dots i}$ 与 $a_{i-len\\times2+1\\dots i-len}$ 不相同。($\\lfloo",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 131072
    },
    "difficulty": {
      "LuoguStyle": "P3"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP8248"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "给你一个数 $n$,你需要求出一个长度为 $n$ 的数组 $a$,(下标从 $1$ 开始,且元素都为 $1,2,3$ 或 $4$),使得:\n\n* 对于第 $i$ 个数,对于所有的 $1 \\le len \\le \\lfloor\\frac{i}{2}\\rfloor$, $a_{i-len+1\\dots i}$ 与 $a_{i-len\\times2+1\\dots i-len}$ 不相同。($\\lfloo...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments