hdu 1058_优先队列
来源:互联网 发布:js读取本地txt文件 编辑:程序博客网 时间:2024/05/16 08:24
http://acm.hdu.edu.cn/showproblem.php?pid=1058
#include <queue>#include <map>#include <iostream>#include <functional>using namespace std;#define MAXI 5843priority_queue<__int64, vector<__int64>, greater<__int64> > Q;__int64 hn[MAXI], l;map<__int64, bool> exi;void init(){ __int64 tmp; l = 1; Q.push(1); while (l < MAXI) { tmp = Q.top(); Q.pop(); if (exi[tmp]) continue; exi[tmp] = 1; hn[l++] = tmp; Q.push(tmp * 2); Q.push(tmp * 3); Q.push(tmp * 5); Q.push(tmp * 7); }}int main(){ int n; init(); while (scanf("%d", &n), n) { printf("The %d", n); if (n % 10 == 1 && n % 100 != 11) printf("st "); else if (n % 10 == 2 && n % 100 != 12) printf("nd "); else if (n % 10 == 3 && n % 100 != 13) printf("rd "); else printf("th "); printf("humble number is %I64d.\n", hn[n]); } return 0;}
0 0
- hdu 1058_优先队列
- 数据结构_优先队列
- 数据结构_优先队列
- 模板_优先队列
- 数据结构_优先队列
- hdu 幸福列车_优先队列+结构体
- HDU-1509 优先队列
- hdu 4006 优先队列
- hdu 2757 优先队列
- HDU 4006 优先队列
- hdu 1509 优先队列
- HDU 4006优先队列
- hdu 1873优先队列
- 【优先队列】HDU Rescue
- HDU 4546 优先队列
- hdu 5437 (优先队列)
- hdu-5596 优先队列
- hdu 4544 优先队列
- Java使用GDAL库
- Hadoop作业调优参数如何调整及原理指导
- POJ 3159 Candies(SPFA+stack)
- Javascript定义类(class)的三种方法
- Fitnesse 测试中使用ComponentQuery定义Object
- hdu 1058_优先队列
- Unsupported major.minor version 51.0
- IDEA导入Android工程,Android Tools不能使用---解决方案
- 使用CCAnimate、CCAnimation、CCTextureCache、CCTexture2D来实现动画效果
- Ubuntu14 + nginx1.7 源码安装
- 程序员,我们应该如何去学习
- duoble的使用
- HDU 1003 MAX SUM 最大连续子段和DP
- Marshal类的使用