This problem was asked by Microsoft.
A number is considered perfect if its digits sum up to exactly 10.
Given a positive integer n, return the n-th perfect number.
For example, given 1, you should return 19. Given 2, you should return 28.
This is one of the problem where you can scratch your head for hours, trying to come up with a "smart" solution but just can't. Unfortunately, it doesn't seem like there's a faster way than simply iterating over all the numbers and keeping track of the current perfect number until we hit n.
本文探讨了一个由微软提出的编程问题:如何找到第n个完美数。在此上下文中,一个完美数是指其各位数字之和恰好等于10的正整数。文章提供了问题的基本解决思路,即通过遍历所有可能的数并检查每个数是否符合条件来找到答案。
9842

被折叠的 条评论
为什么被折叠?



