文件名称:uglynumber
介绍说明--下载内容均来自于网络,请自行研究使用
构造一个集合,里面的数都是丑数,那么任意取一个集合内的数,假设为k,那么2k,3k,5k,7k也是丑数,丢进集合中。因为要求第n小,那么考虑优先队列取前n小数,从1开始扩展集合,重复n次操作,最后的数便是答案。(Construct a set whose numbers are all ugly numbers, then take the number of a collection arbitrarily, assuming that it is K. Then 2K, 3k, 5K and 7K are also ugly numbers and are thrown into the set. Since the request for n is small, then the first N decimal number of priority queues is considered, and the set is extended from 1, and the N operation is repeated, and the final number is the answer.)
相关搜索: 算法与数据结构
(系统自动生成,下载前可以参看下载内容)
下载文件列表
文件名 | 大小 | 更新时间 |
---|---|---|
丑数.cpp | 1940 | 2018-01-03 |
丑数.exe | 135434 | 2018-01-03 |
丑数.o | 2295 | 2018-01-03 |