先找出所有的数,排序,然后o(1)效率询问

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
using namespace std; long long Ans[];
int tot;
map<long long, int>Cun;
const long long INF = 1e18; void init()
{
tot = ;
Cun.clear();
Cun[] = ;
Ans[tot] = ;
} int main()
{
int head = ;
init();
while ()
{
if (Ans[head] == ) break;
long long h = Ans[head];
if (h * > INF || Cun[h * ] == ) {}
else
{
tot++;
Ans[tot] = h * ;
Cun[h * ] = ;
} if (h * > INF || Cun[h * ] == ){}
else
{
tot++;
Ans[tot] = h * ;
Cun[h * ] = ;
} if (h * > INF || Cun[h * ] == ) {}
else
{
tot++;
Ans[tot] = h * ;
Cun[h * ] = ;
} if (h * > INF || Cun[h * ] == ) {}
else
{
tot++;
Ans[tot] = h * ;
Cun[h * ] = ;
}
head++;
}
sort(Ans, Ans + tot + );
int T;
scanf("%d", &T);
while (T--)
{
int n;
scanf("%d", &n);
printf("%lld\n", Ans[n - ]);
}
return ;
}

POJ 3307 Smart Sister的更多相关文章

  1. poj 3307 Smart Sister 打表解因子生成数问题

    题意: 给i,求由仅以2,3,5,7为因子的数中第i个是多少. 分析: 打表. 代码: //poj 3307 //sep9 #include <iostream> using namesp ...

  2. (01背包变形) Cow Exhibition (poj 2184)

    http://poj.org/problem?id=2184   Description "Fat and docile, big and dumb, they look so stupid ...

  3. POJ - 2339 Rock, Scissors, Paper

    初看题目时就发了个错误,我因为没有耐心看题而不了解题目本身的意思,找不到做题的突破口,即使看了一些题解,还是没有想到方法. 后来在去问安叔,安叔一语道破天机,问我有没有搞清题目的意思,我才恍然大悟,做 ...

  4. POJ 3974 Palindrome

    D - Palindrome Time Limit:15000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Sub ...

  5. POJ 3104 Drying(二分答案)

    题目链接:http://poj.org/problem?id=3104                                                                  ...

  6. POJ 2960 博弈论

    题目链接: http://poj.org/problem?id=2960 S-Nim Time Limit: 2000MS Memory Limit: 65536K 问题描述 Arthur and h ...

  7. 【POJ 3162】 Walking Race (树形DP-求树上最长路径问题,+单调队列)

    Walking Race   Description flymouse's sister wc is very capable at sports and her favorite event is ...

  8. [POJ 2184]--Cow Exhibition(0-1背包变形)

    题目链接:http://poj.org/problem?id=2184 Cow Exhibition Time Limit: 1000MS   Memory Limit: 65536K Total S ...

  9. poj 1012——Toseph

    提交地址:http://poj.org/problem?id=1012                                                                 ...

随机推荐

  1. Python使用shape计算矩阵的行和列

    shape函数是numpy.core.fromnumeric中的函数,它的功能是读取矩阵的长度. 1 >>> a=mat([[1,2,3],[5,6,9]]); 2 >> ...

  2. ural 1091. Tmutarakan Exams(容斥原理)

    1091. Tmutarakan Exams Time limit: 1.0 secondMemory limit: 64 MB University of New Tmutarakan trains ...

  3. knockout.js-创建视图模型

    监控属性(Observables) knockout的三个核心特点: 1.监控属性与依赖跟踪 2.声明式绑定 3.模板 本页,你将学习上述三个特性.但是在这之前,先了解一下MVVC模式,及 视图模型( ...

  4. windows service and process 的关系

    1.查询windows 对应的服务 sc query > 1.txt notepad 1.txt 2.查询对应的进程信息 tasklist /m > tasks.txt notepad t ...

  5. Microsoft SqlSever 数据库--软谋1

    百度百科--Microsoft SqlSever SQL是英文Structured Query Language的缩写,意思为结构化查询语言.SQL语言的主要功能就是同各种数据库建立联系,进行沟通.按 ...

  6. Base64技术:把对象转变成字符串

    需求:在安卓移动端和服务器进行数据交互的时候,有些时候需要上传,下载文件.如果所有的参数都变成字符串,会更加方便. 原理:Base64只是把byte[]数组进行了编码,然后再解码的过程,文档内容无法直 ...

  7. java URL编程

    一.URL编程技术 URL是统一资源定位器的缩写,它是指向互联网“资源”的指针.URL表示了Internet上某个资源的地址.URL支持http,file,ftp等 多种协议.通过URL标识,可以直接 ...

  8. 数组实现UITabview的cell设置

  9. 让上下两个DIV块之间有一定距离或没有距离

    1.若想上下DIV块之间距离,只需设定:在CSS里设置DIV标签各属性参数为0div{margin:0;border:0;padding:0;}这里就设置了DIV标签CSS属性相当于初始化了DIV标签 ...

  10. html5学习(三)

    html5特点: 1 微数据与微格式等方面的支持. 2 本地存储,离线应用. 3 API调用,地图,位置,LBS等. 4 连接通讯,后台线程. 5 多媒体. 7 css3.