POJ 1019 Number Sequence
来源:互联网 发布:中世纪黑暗故事 知乎 编辑:程序博客网 时间:2024/04/27 12:51
Number Sequence
Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 20096 Accepted: 5271
Description
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
For example, the first 80 digits of the sequence are as follows:
11212312341234512345612345671234567812345678912345678910123456789101112345678910
Input
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)
Output
There should be one output line per test case containing the digit located in the position i.
Sample Input
283
Sample Output
22
Source
Tehran 2002, First Iran Nationwide Internet Programming Contest
题目大意:给出串“11212312341234512345612345671234567812345678912345678910123456789101112345678910……”问第N个是几
题目分析:如下
1
1 2
1 2 3
1 2 3 4
……
即可求出第N个在第几行 于是转化为 求串“12345678910111213……”中第N'是几
代码如下:
- POJ 1019 Number Sequence
- POJ 1019 Number Sequence
- poj 1019 Number Sequence
- poj 1019 Number Sequence
- POJ 1019 Number Sequence
- poj 1019 Number Sequence
- POJ-1019 Number Sequence
- POJ 1019 Number Sequence
- poj 1019 Number Sequence
- poj 1019 Number Sequence
- POJ 1019 Number Sequence
- poj 1019 Number Sequence
- POJ 1019 Number Sequence
- POJ 1019 Number Sequence
- poj 1019 Number Sequence
- POJ 1019 Number Sequence
- poj 1019 Number Sequence
- POJ 1019 Number Sequence
- 北大第一医院中年女教授死亡之争引发的思考
- delphi中exit,abort,break,continue 的区别
- Java执行.exe文件
- 先前的梦境神奇成真
- Thinkpad x61 重新安装一例
- POJ 1019 Number Sequence
- 《我的WCF之旅》博文系列汇总
- 寻NP难解问题的实例
- 【转】常用电平标准
- ibatis怎么和spring集成呢?
- J2ME Polish的build功能(一)
- ASP.NET中的Eval()和DataBinder.Eval()方法
- .htaccess 不起作用的原因
- J2ME polish使用心得一(介绍j2mepolish)