Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6dfdec3

Browse files
author
chenxuyan
committed
格式化代码
1 parent ccc4a2e commit 6dfdec3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎solution/0400-0499/0400.Nth Digit/Solution.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
class Solution {
2+
/***
3+
* 12345678910111213
4+
* 规律个位数9个数一共有9*1,两位数90个数 一共有90*2个数字,三位数有900个数一共有900*3个数字,以此类推
5+
* 举例15,15-9=6,6/2=3...0,余数是0,那么这个数值value=10*(2-1)+(3-1)=12,整除取最后一位 12%10=2
6+
* 举例14,14-9=5,5/2=2...1,余数不为0,那么这个数值value=10*(2-1)+2=12,则为这个数的第余数个 12/(10*(2-1))%10=1
7+
*/
28
public int findNthDigit(int n) {
3-
/***
4-
* 12345678910111213
5-
* 规律个位数9个数一共有9*1,两位数90个数 一共有90*2个数字,三位数有900个数一共有900*3个数字,以此类推
6-
* 举例15,15-9=6,6/2=3...0,余数是0,那么这个数值value=10*(2-1)+(3-1)=12,整除取最后一位 12%10=2
7-
* 举例14,14-9=5,5/2=2...1,余数不为0,那么这个数值value=10*(2-1)+2=12,则为这个数的第余数个 12/(10*(2-1))%10=1
8-
*/
99
long max = 9;
1010
long num = n;
1111
long digits = 1;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /