当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2514:Ridiculous Addition

题目描述
Let us write down the infinite consecutive integers in a sequence in one line without any space and their squares in the second line. This will generate two different long numbers, now we want to find the sum of these two numbers. The calculation of the first 30 digits is just as below.

The first digit of the result is 2, the second digit is 7, and the third is 2 and so on. Given an integer k, you should output the digit at position k in the resulting number.
输入解释
The input file will contain several test cases. In each of the test cases, there is an integer k (0 < k <= 2 ^ 31 - 1) in one line.

A line containing a number "0" terminates input, and this line need not be processed.
输出解释
For each test case you should generate a line of output, which is the digit in the k-th place of the addition result.
输入样例
2
5
30
0
输出样例
7
1
8

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-2514

最后修改于 2020-10-29T06:34:35+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536