[CF1216E] Numerical Sequence hard version】的更多相关文章

题目 The only difference between the easy and the hard versions is the maximum value of k. You are given an infinite sequence of form "112123123412345…" which consist of blocks of all consecutive positive integers written one after another. The fi…
http://codeforces.com/problemset/problem/1216/E1 E1. Numerical Sequence (easy version) time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The only difference between the easy and the hard ver…
cf1216E2 Numerical Sequence (hard version) 题目大意 一个无限长的数字序列,其组成为\(1 1 2 1 2 3 1.......1 2 ... n...\),即重复的\(1~1,1~2....1~n\),给你一个k,求第k(k<=1e18)个数字是什么 solution 暴力枚举妥妥T掉 手摸能看出来每一个单独的序列是等差数列 然后每一个序列的数字个数也是等差数列 如果预处理出等差数列的数组,那么询问的时候直接调用即可 参考lzz的blogs 说说这一段…
题目描述 The only difference between the easy and the hard versions is the maximum value of k. You are given an infinite sequence of form "112123123412345--" which consist of blocks of all consecutive positive integers written one after another. The…
题目链接 问题分析 奇奇怪怪的题... 首先思路达成一致,从大到小一步一步确定位置. 我们一边分析,一边讲算法. 112123123412345123456123456712345678123456789123456789101234567891011123456789101112 假设我们现在要找的是这个串中的倒数第二个位置(就是1),我们可以这样做: 首先,我们想象着把串分开,变成 1 12 123 1234 12345 123456 1234567 12345678 123456789 1…
题目大意 有一个无限长的数字序列,其组成为1 1 2 1 2 3 1.......1 2 ... n...,即重复的1~1,1~2....1~n,给你一个\(k\),求第\(k(k<=10^{18})\)个数字是什么. 思路 设\(a[i]\)为该数到达\(i\)的长度,\(b[i]\)为第\(i\)个数那一块的长度,\(\sum b[i]=a[i]\),发现\([10^i,10^{i+1})\)的数长度均为\(i+1\),那么在这一段中\(b[i]\)都是一个等差数列,而计算\(a[i]\)就…
题目: 题意: 已知一个序列: 112123123412345123456123456712345678123456789123456789101234567891011... 求这个序列第k个数是多少. 分析: 首先,我们先来看这样一个问题,让求123456789101112131415...一直到n的长度是多少,我们会怎么求呢?显然,我们会分开求:1-9一组,10-99一组,100-999一组...当然组数不会很多,然后组内其实就是一些位数相等的数的位数的和,那么当然用乘法解决,数清项数就好…
The only difference between the easy and the hard versions is the maximum value of \(k\). You are given an infinite sequence of form "112123123412345-" which consist of blocks of all consecutive positive integers written one after another. The f…
考虑\(D1\)的\(O(n^2)\),我们直接进行组合处理. 考虑在\(p\)这个位置,左边有\(l\)个(,右边有\(r\)个),左边有\(l\)个问号,右边有\(r\)个问号. 这个位置的贡献为: \(\sum_{i = 0} ^ x (l+i)\binom{x}{i}\binom{y}{l + i - r}\) 考虑我们拆项. \(l\sum_{i = 0} ^ x\binom{x}{i}\binom{y}{l + i - r} + \sum_{i = 0} ^ x i\binom{x}…
考虑在一个确定的括号序列中,我们可以枚举中间位置,按左右最长延伸出去的答案计算. 我们很自然的思考,我们直接维护左右两边,在删除一些字符后能够延伸的最长长度. 我们设\(f_{i,j}\)为\(i\)点合法删除向左延伸的最大长度. \( f_{i,j} = \left\{ \begin{aligned} &f_{i - 1,j} (a[i] = ')'\ )\\ &f_{i - 1,j - 1}(a[i] = ')'\ )\\ &f_{i - 1,j} + f_{i - 1 ,j…