Numerical Sequence (Hard vision) 题解】的更多相关文章

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…
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 说说这一段…
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…
题目 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…
题目描述 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…
一个简单的模拟,首先先计算当前是几位数,然后根据几位数推断当前的数是什么,然后求出该位即可 #include <cstdio> int main(){ long long k; scanf("%lld", &k); long long cur = 1, cnt = 9; while (cur * cnt < k){k -= cur * cnt; cnt *= 10, ++cur;} long long mod = k % cur, a = (k - 1) /…
题目: 题意: 已知一个序列: 112123123412345123456123456712345678123456789123456789101234567891011... 求这个序列第k个数是多少. 分析: 首先,我们先来看这样一个问题,让求123456789101112131415...一直到n的长度是多少,我们会怎么求呢?显然,我们会分开求:1-9一组,10-99一组,100-999一组...当然组数不会很多,然后组内其实就是一些位数相等的数的位数的和,那么当然用乘法解决,数清项数就好…
题目大意 有一个无限长的数字序列,其组成为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]\)就…
Content 一个序列由从 \(1\) 开始的数字不断在末端拼接,就像这样:\(12345678910111213141516...\).现在,给定一个数字 \(k\),请输出这个序列的第 \(k\) 个数字. 数据范围:\(1\leqslant k\leqslant 10000\). Solution 这题的数据范围不是很大,我们可以直接模拟得到长度为 \(10000\) 的序列,然后就可以直接输入输出了. Code int n = 1, cur, d[10007]; int main()…