一个简单的模拟,首先先计算当前是几位数,然后根据几位数推断当前的数是什么,然后求出该位即可

#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) / cur;
if (!mod) mod = cur;
long long num = 1;
for (int i = 1; i < cur; ++i) num *= 10;
num += a;
for (int i = 1; i <= (cur - mod); ++i) num /= 10;
printf("%lld", num % 10);
return 0;
}

[CF1177B]Digits Sequence (Hard Edition)题解的更多相关文章

  1. CF1177A Digits Sequence (Easy Edition) 题解

    Content 一个序列由从 \(1\) 开始的数字不断在末端拼接,就像这样:\(12345678910111213141516...\).现在,给定一个数字 \(k\),请输出这个序列的第 \(k\ ...

  2. Numerical Sequence (Hard vision) 题解

    The only difference between the easy and the hard versions is the maximum value of \(k\). You are gi ...

  3. 【Leetcode周赛】从contest-81开始。(一般是10个contest写一篇文章)

    Contest 81 (2018年11月8日,周四,凌晨) 链接:https://leetcode.com/contest/weekly-contest-81 比赛情况记录:结果:3/4, ranki ...

  4. Codeforces Edu Round 59 A-D

    A. Digits Sequence Dividing 注意特殊情况,在\(n = 2\)时除非\(str[1] >= str[2]\),否则可以把第一个数划分下来,剩下的数直接当成一组,一定满 ...

  5. Educational Codeforces Round 59 Solution

    A. Digits Sequence Dividing 签. #include <bits/stdc++.h> using namespace std; #define N 1010 ch ...

  6. Poj 2533 Longest Ordered Subsequence(LIS)

    一.Description A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequenc ...

  7. #410div2C. Mike and gcd problem

    C. Mike and gcd problem time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  8. Educational Codeforces Round 59 (Rated for Div. 2) (前四题)

    A. Digits Sequence Dividing(英文速读) 练习英语速读的题,我还上来昏迷一次....只要长度大于2那么一定可以等于2那么前面大于后面就行其他no 大于2的时候分成前面1个剩下 ...

  9. 【CF486E】LIS of Sequence题解

    [CF486E]LIS of Sequence题解 题目链接 题意: 给你一个长度为n的序列a1,a2,...,an,你需要把这n个元素分成三类:1,2,3: 1:所有的最长上升子序列都不包含这个元素 ...

随机推荐

  1. python 使用 with open() as 读写文件

    读文件: 要以读文件的模式打开一个文件对象,使用Python内置的open()函数,传入文件名和标示符: >>> f = open('E:\python\python\test.tx ...

  2. kafak学习(一)

    发布与订阅消息系统. 数据(消息)的发送者不会直接把消息发送给接受者,这是发布与订阅消息系统的一个特点.发布者以某种方式对消息进行分类,接受者订阅他们,以便接受特定类型的消息.发布与订阅系统一般会有一 ...

  3. 避免浏览器缓存JS

    有时候更改了JS代码,但是浏览器内容不变,这样<script src="Scripts/myjs/Master.js?v"></script>引入JS就可以 ...

  4. 更新代码 出现 You need to upgrade the working copy first 错误

    今天更新了Eclipse的subclipse插件,更新代码报如下错误: svn: The working copy at 'E:\591woospace\kst_fashion_alipay_v1.2 ...

  5. centos7里创建用户和组

    1.创建组distro,其GID为2019groupadd -g 2019 distro 2.创建用户mandriva, 其ID号为1005:基本组为distro useradd mandriva - ...

  6. (4.25)Sqlserver中 登录用户只能看到自己拥有权限的库

    Sqlserver中 登录用户只能看到自己拥有权限的库 转自:https://www.cnblogs.com/huangtailang/p/4209180.html 相关参考:https://www. ...

  7. P1622释放囚犯

    这是一道绿题,是一道让人想用贪心但却是区间DP的题目,难倒了我这个蒟蒻. 这个题其实仔细观察是类似于石子合并的!合并石子的代价便是肉的数量,求最小代价.所以我们设dp[i][j]为释放第i个到第j个所 ...

  8. 搜索专题: HDU1501Zipper

    Zipper Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Sub ...

  9. linux查找进程id和杀死进程以及查看内存??

    ps 命令用于查看当前正在运行的进程 ps ax : 显示当前系统进程的列表 ps aux : 显示当前系统进程详细列表以及进程用户 -e 显示所有进程,环境变量 此参数的效果和指定"A&q ...

  10. 开发jquery插件小结

    用jquery开发插件其实很简单.今天实现了一个入门级别的功能. 随便来个DIV,便于理解. div{ height:100px;width:100px;display:block;backgroun ...