CF1065G.Fibonacci Suffix

省选/NOI-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Let's denote (yet again) the sequence of Fibonacci strings:

$F(0) = $ 0, $F(1) = $ 1, F(i)=F(i−2)+F(i−1)F(i) = F(i - 2) + F(i - 1), where the plus sign denotes the concatenation of two strings.

Let's denote the lexicographically sorted sequence of suffixes of string F(i)F(i) as A(F(i))A(F(i)). For example, F(4)F(4) is 01101, and A(F(4))A(F(4)) is the following sequence: 01, 01101, 1, 101, 1101. Elements in this sequence are numbered from 11.

Your task is to print mm first characters of kk-th element of A(F(n))A(F(n)). If there are less than mm characters in this suffix, then output the whole suffix.

我们再次定义斐波那契字符串序列:

$F(0) = $ 0,$F(1) = $ 1,F(i)=F(i−2)+F(i−1)F(i) = F(i - 2) + F(i - 1),其中加号表示两个字符串的拼接。

记字符串 F(i)F(i) 的所有后缀按字典序排序后的序列为 A(F(i))A(F(i))。例如,F(4)F(4) 为 01101,其 A(F(4))A(F(4)) 序列为:01,01101,1,101,1101。该序列中的元素编号从 11 开始。

你的任务是输出 A(F(n))A(F(n)) 中第 kk 个元素的前 mm 个字符;若该后缀长度不足 mm,则输出整个后缀。

输入格式

The only line of the input contains three numbers nn, kk and mm (1≤n,m≤2001 \le n, m \le 200, 1≤k≤10181 \le k \le 10^{18}) denoting the index of the Fibonacci string you have to consider, the index of the element of A(F(n))A(F(n)) and the number of characters you have to output, respectively.

It is guaranteed that kk does not exceed the length of F(n)F(n).

输入仅包含一行,三个数字 nn、kk 和 mm(1≤n,m≤2001 \le n, m \le 200,1≤k≤10181 \le k \le 10^{18}),分别表示你需要考虑的斐波那契字符串的索引、A(F(n))A(F(n)) 中元素的索引,以及你需要输出的字符个数。

保证 kk 不超过 F(n)F(n) 的长度。

输出格式

Output mm first characters of kk-th element of A(F(n))A(F(n)), or the whole element if its length is less than mm.

输出 A(F(n))A(F(n)) 中第 kk 个元素的前 mm 个字符;若该元素长度小于 mm,则输出整个元素。

输入输出样例

  • 输入#1

    4 5 3

    输出#1

    110
  • 输入#2

    4 3 3

    输出#2

    1

输入解题思路,AI测评打分。不知道怎么写?

首页