We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
假如 n 是数字的位数, 则有 f(n) = f(n-1) * 9 + 10^(n-1): f(n-1)*9: 因为高位有[1, 9]共计9种数字搭配地位; 10^(n-1): 高位的7搭配地位的所有可能数字可能;
f(n) = f(n-1) * 9 + 10^(n-1)
f(n-1)*9
10^(n-1)
f(n) = f(n-1) * 9 + 10^(n-1) 且 f(0) = 0 f(1) = f(0)*9 + 10^(1-1) = 0*9 + 10^0 = 1 f(2) = f(1)*9 + 10^(2-1) = 1*9 + 10^1 = 19 f(3) = f(2)*9 + 10^(3-1) = 19*9 + 10^2 = 271 f(4) = f(3)*9 + 10^(4-1) = 271*9 + 10^3 = 3439
同样会有公式
f(n) = f(n-1) * 10 + 10^(n-1) 且 f(0) = 0 f(1) = f(0)*10 + 10^(1-1) = 0*10 + 10^0 = 1 f(2) = f(1)*10 + 10^(2-1) = 1*10 + 10^1 = 20 f(3) = f(2)*10 + 10^(3-1) = 20*10 + 10^2 = 300 f(4) = f(4)*10 + 10^(4-1) = 300*10 + 10^3 = 4000
这种场景的结果有很明显的规律: f(n) = n * 10^(n-1), 可以参加思路 https://www.jianshu.com/p/8e1844d80143
f(n) = n * 10^(n-1)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
说明
思路
假如 n 是数字的位数, 则有
f(n) = f(n-1) * 9 + 10^(n-1)
:f(n-1)*9
: 因为高位有[1, 9]共计9种数字搭配地位;10^(n-1)
: 高位的7搭配地位的所有可能数字可能;如果 7 和 07 算作两个有效数字
同样会有公式
这种场景的结果有很明显的规律:
f(n) = n * 10^(n-1)
, 可以参加思路 https://www.jianshu.com/p/8e1844d80143The text was updated successfully, but these errors were encountered: