描述
A single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2...Sk. Each group Sk consists of a sequence of positive integer numbers ranging from 1 to k, written one after another.
For example, the first 80 digits of the sequence are as follows:
11212312341234512345612345671234567812345678912345678910123456789101112345678910
输入
The first line of the input file contains a single integer t (1 ≤ t ≤ 10), the number of test cases, followed by one line for each test case. The line for a test case contains the single integer i (1 ≤ i ≤ 2147483647)
输出
There should be one output line per test case containing the digit located in the position i.
样例输入
2
8
3样例输出
2
2
问题分析:
先找规律,可以发现数列排成梯形。首先初想建表,算下数据大小,发现表规模不是很大,不超过4w,且为O(1)。
算法:
1.建表
2.输入测试数据
3.根据表数据,计算输出结果
分享到:
相关推荐
ISO_TR 22400-10:2018 Automation systems and integration - Key performance indicators (KPis) for manufacturing operations management - Part 10:Operational sequence description of data acquisition - ...
本工程为 MyBatis-Plus 的官方示例,项目结构如下: mybatis-plus-sample-quickstart: 快速开始示例 ...mybatis-plus-sample-sequence: Sequence示例 mybatis-plus-sample-execution-analysis: Sql执行分析示例
完整英文版ISO-TR 22400-10:2018 Automation systems and integration - Key performance indicators (KPis) for manufacturing operations management - Part 10:Operational sequence description of data ...
解决Invalid byte 1 of 1-byte UTF-8 sequence
北大POJ1019-Number Sequence 解题报告+AC代码
invalid multibyte character sequence 870告警1
- NEW: CSV reader will now convert the "\n" character sequence into a new line char. - FIX: Scenes using NGUI should no longer get marked edited so much. - FIX: Reduced the size of meshes used by NGUI...
ORA-00312: online log 1 thread 1: '/oradata/10g/db/instant/redo01.log' SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE=4294967296 SCOPE=BOTH; System altered.... SQL> shutdown immediate ...
这个怎么运作用YAML编写测试,如下所示: ---- test: "Sequence 01. Test scenario: launch request, no further interaction."- LaunchRequest: # LaunchRequest is not an utterance but a request type and ...
(创建是因为我在使用纯JavaScript的解决方案时遇到了性能问题,例如: : ) 它是围绕iOS UIImageView.animationImages和Android AnimationDrawable的简单包装安装npm i --save react-native-image-sequence react-...
memory networks, are extremely appealing for sequence-tosequence learning tasks. Despite their great success, they typically suffer from a fundamental shortcoming: they are prone to generate ...
要么跑 php composer.phar require "amilna/yii2-sequence-widget" "*"或添加 " amilna/yii2-sequence-widget " : " * " 到应用程序的composer.json文件的 require 部分。 由于此扩展仍处于开发阶段,因此请务必在...
语法为:sequence1 + sequence2,表达结果是包含 sequence1和sequence2的内容的新序列。 重复操作符(*):当你需要⼀个序列的多个拷贝时,语法为:sequence * copy_int(必须为整形)。 切⽚操作符([],[:]):访问某⼀...
论文《End-to-end Sequence Labeling via Bi-directional LSTM-CNNs-CRF》的代码实现
bower install --save m3u8-parser 用法var manifest = [ '#EXTM3U' , '#EXT-X-VERSION:3' , '#EXT-X-TARGETDURATION:6' , '#EXT-X-MEDIA-SEQUENCE:0' , '#EXT-X-DISCONTINUITY-SEQUENCE:0' , '#EXTINF:6,' , '0.ts...
(译文)End-to-End Radio Traffic Sequence Recognition with Deep Recurrent Neural Networks
序列可视化演示使用Sequence-viz库的工作示例
State-of-the-art sequence labeling systems traditionally require large mounts of task-specific knowledge in the form of hand-crafted features and data pre-processing.In this paper, we introduce a ...
- encoder: Updated and Improved Sequence/GOP design architecture (AL) - encoder/decoder: Various cleanups/bugfixes (AT) - encoder/decoder: Deblocking speedups (AT) - encoder/decoder: add version ...
解析并生成定义的JSON文本序列。 JSON文本序列非常适合明确的JSON日志文件。 它们可以抵抗多种形式的损坏,例如截断,错误地将多个编写器... const parser = require('json-text-sequence').parser; const fs = requi