313. Super Ugly Number

Write a program to find the nthsuper ugly number.

313. Super Ugly Number_第1张图片

Super ugly numbers are positive numbers whose all prime factors are in the given prime listprimesof sizek. For example,[1, 2, 4, 7, 8, 13, 14, 16, 19, 26, 28, 32]is the sequence of the first 12 super ugly numbers givenprimes=[2, 7, 13, 19]of size 4.

264. Ugly Number II 理解264 ,那么313就容易多了, 原理是一样的, 264用3个值记录, 313 用一个数组记录。

313. Super Ugly Number_第2张图片

你可能感兴趣的:(313. Super Ugly Number)