题意:

  求数字11212312341234512345612345671234567812345678912345678910123456789101112345678910111212345678910111213...的第i位是几?

数位dp打表+二分+暴力模拟

0msAC哦!暴力美学!

 #include <set>
#include <map>
#include <cmath>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int a[],f[],b[],i_b;
int digit(int x) {
if(x>)return ;
if(x>)return ;
if(x>)return ;
if(x>)return ;
if(x>)return ;
if(x>)return ;
if(x>)return ;
if(x>)return ;
if(x>)return ;
return ;
}
int main() {
int i,j,k;
for(i=; i<=; i++) {
for(j=i; j>=; j--)
if(f[j]) {a[i]+=f[j];break;}
else a[i]+=digit(j);
f[i]=a[i];
a[i]+=a[i-];
}//a[31267]=2147378477
int T,I;
for(scanf("%d",&T); T--;) {
scanf("%d",&I);
int l=,r=;
while(r-l>) {
int mid=(l+r)/;
if(I>a[mid])l=mid;
else if(I==a[mid])l=mid,r=mid;
else r=mid;
}
int cnt=I-a[l],num,ans;
if(!cnt) {cout<<l%<<endl;continue;}
for(i=l+; cnt; i++)
for(j=; j<=i && cnt; j++)
for(num=j,ans=,k=j; k && cnt; k/=,cnt--,ans++);
for(i_b=,k=num; k ; b[++i_b]=k%,k/=);
cout<<b[i_b-ans+]<<endl;
}
return ;
}

最新文章

  1. 漫谈JVM
  2. 某篇ctr预估ppt的链接
  3. 如何设置UNIX/Linux中新创建目录或文件的默认权限
  4. Counting Rectangles
  5. POJ 3308 Paratroopers(最小割EK(邻接表&amp;矩阵))
  6. HDU 1230 火星A+B
  7. jQuery的选择器中的通配符[id^=&#39;code&#39;] 【转】
  8. 获取电脑cpu的使用情况
  9. SQL SERVER的检查点checkpoint
  10. XJOI练习2神奇的供水系统
  11. UIDatePicker的使用
  12. ABP入门系列之1——ABP总体介绍
  13. 自制操作系统Antz(13) 显示图片
  14. C语言-第5次作业
  15. ES6学习笔记(let,const,变量的解构赋值)
  16. VS2015下安装Entity Framework Power Tools
  17. python:&#39;ascii&#39; codec can&#39;t encode character
  18. Css+JS模拟实现可编辑的表格
  19. TACACS+简单说明
  20. WireShark 查看UDP码流的丢包率

热门文章

  1. 2020 CCPC Wannafly Winter Camp Day1 Div.1&amp;amp F
  2. centos系统mongodb安装
  3. gulp常用插件之gulp-babel使用
  4. Fastbin attack
  5. 小白月赛22 D : 收集纸片
  6. Ioc依赖注入:Unity4.0.1 在项目中的应用 (MVC和API)
  7. XSS漏洞的poc与exp
  8. 洛谷P3381 MCMF【网络流】
  9. JSON JavaScriptSerializer 进行序列化或反序列化时出错。字符串的长度超过了为 maxJsonLength 属性设置的值
  10. Ubuntu18.04安装phpMyAdmin