Chloe, the same as Vladik, is a competitive programmer. She didn't have any problems to get to the olympiad like Vladik, but she was confused by the task proposed on the olympiad. Let's consider the following a
析:很明显是用递归来做,如果k在前半部分,那么就再递归,如果是在后半部分,那么就是先减一半再递归。代码如下:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 ...
The task is to find the value of the element with index k (the elements are numbered from 1) in the obtained sequence, i. e. after (n - 1) steps. Please help Chloe to solve the problem! Input The only line contains two integers n and k (1 ≤ n ≤ 50, 1 ≤...
The task is to find the value of the element with index k (the elements are numbered from 1) in the obtained sequence, i. e. after (n - 1) steps. Please help Chloe to solve the problem! Input The only line contains two integers n and k (1 ≤ n ≤ 50, 1 ≤...
CodeForces 743B Chloe and the sequence (递归),题意:给定n和k,求第n个序列中第k个数是多少,序列是这样构造,原来只有1,然后再copy一遍放在到后面再在中间放上一个没有出现过的最小整数,就变成了121,下次就成了1213121。析:很明显是用递归来做,如果k在前半部分,
CF743B Chloe and the sequence 题解 分治 题目链接:http://codeforces.com/problemset/problem/743/B 题目大意: 对于一个 n-序列,如果 n==0 ,那么它是一个空的序列(也就是说空序列中没有元素)。 然后会进行 i 次操作,每次操作,会在原序列末尾添加一次原序列,并且在两个原序列之间插入一个值为 i 的...
CF743B Chloe and the sequence 题解 递归 题目链接:http://codeforces.com/problemset/problem/743/B 题目描述 灵灵最近发明了一个序列,他称他的序列为n−n−序列。 对于一个n−n−序列,如果n=0n=0,那么它是一个空的序列(也就是说空序列中没有元素)。
codeforces round # 384 div2 B Chloe and the sequence 神奇二进制找规律题 链接:https://codeforces.com/contest/743/problem/B 题意:n-1次操作,每次往数列后加未出现过的最小数字后,再将原数列复制一次粘到新序列末尾后,问第n-1次操作后 第k位是几。
Please help Chloe to solve the problem! 输入 The only line contains two integers n and k (1 ≤ n ≤ 50, 1 ≤ k ≤ 2n - 1). 输出 Print single integer — the integer at the k-th position in the obtained sequence. ...
CF743B Chloe and the sequence 题解 递归,题目链接:"http://codeforces.com/problemset/problem/743/B"题目描述灵灵最近发明了一个序列,他称他的序列为$n$序列。对于一个$n$序列,如果$n=0$,那么它是一个空的序列(也就是说空序列中没有元素)。然后他会进行$i$次操作