UVa 136 Ugly Numbers
来源:互联网 发布:方太淘宝旗舰店 编辑:程序博客网 时间:2024/06/04 18:17
#include<iostream>#include<cstdio>#include<string>#include<map>#include<algorithm>#include<vector>#include<queue>#include<set>#include<cstring>#include<stack>using namespace std;const int arr[]={2,3,5};typedef long long LL;int main(){priority_queue<LL,vector<LL>,greater<LL> > pq;int i,j;set<LL> S;S.insert(1);pq.push(1);for(i=1;;i++){LL t=pq.top();pq.pop();if(i==1500){cout<<"The 1500'th ugly number is "<<t<<"."<<endl;break;}for(j=0;j<3;j++){LL num=t*arr[j];if(!S.count(num)){pq.push(num);S.insert(num);}}}return 0;}
0 0
- UVa 136 - Ugly Numbers
- UVa 136 - Ugly Numbers
- UVa 136 - Ugly Numbers
- UVA - 136 Ugly Numbers
- UVA 136 Ugly Numbers
- Uva - 136 - Ugly Numbers
- UVA 136 Ugly Numbers
- UVA 136 Ugly Numbers
- UVA - 136 Ugly Numbers
- UVA 136 Ugly Numbers
- UVa 136 Ugly Numbers
- UVa 136 Ugly Numbers
- UVA - 136 Ugly Numbers
- Uva 136 - Ugly Numbers
- UVa 136 Ugly Numbers
- UVA-136 Ugly Numbers
- UVA 136 Ugly Numbers
- Ugly Numbers, UVa 136
- PCA原理及人脸识别
- 设计模式(三)装饰模式
- 列表解析(list comprehension) 与三目运算符
- 百度地图之覆盖物
- 自定义 UINavigationController
- UVa 136 Ugly Numbers
- pdb命令行调试Python代码
- <a>元素也能玩出新鲜样儿
- jsp编译原理
- SecureCRT满屏后如何设置不自动清除
- C++函数中参数的传递
- 设计模式:观察者模式
- 设计模式——命令模式
- 数据解析出错