「STL练习」丑数

2016年6月15日4,1151

题目描述

丑数是指不能被2,3,5以外的其他素数整除的数。把丑数从小到大排列起来,结果如下:
1,2,3,4,5,6,8,9,10,12,15,……
请编写一个程序,求第k个丑数。

输入

一个整数k(k<=1500)。

输出

仅有一个整数为第k大丑数。

样例输入

样例输出

题解

STL练习,每次从数据结构中取出最小值x,加入2x,3x,5x

priority_queue

priority_queue+map

 

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
NewLinZiyu Recent comment authors
  Subscribe  
提醒
NewLinZiyu
NewLinZiyu

还可以用set来记录每个丑数