hdu---------3189-------------------
水体一个,但是这种做题的方法值得发扬光大............
Just Do It Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others)
Total Submission(s): Accepted Submission(s): Problem Description
Now we define a function F(x), which means the factors of x. In particular, F() = ,since only has factor , F() = , since has factors , , . Now give you an integer k, please find out the minimum number x that makes F(x) = k. Input
The first line contains an integer t means the number of test cases.
The follows t lines, each line contains an integer k. ( < k <= ). Output
For each case, output the minimum number x in one line. If x is larger than , just output -. Sample Input Sample Output -
意思大概是,,,,,,9的因子都有1 3 9 三个数字 4也有三个因子 现在输入一个3 你需要输出 4(因为4 是有三个因子的数字中最小的数字)....意思就是这 很简单打表遍历,,,,但是 遍历的时候想到了,,, 如果倒序 遍历的话,例如 便利到9发现有3个因子,
这时候数组赋值为 a[3]=9; 然后一会有到4了,也是4个因子 在此进行赋值 a[3]=4; 这样的话,,简单又弱智
#include<stdio.h>
#include<string.h>
int main()
{
int q,i,j,m,n,t,a[],b,c;
memset(a,,sizeof(a));
for(i=;i>;i--)
{
q=;
for(j=i;j>;j--)
{
if(i%j==)
q++;
}
a[q]=i;
}
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
m=a[n];
if(m==)
m=-;
printf("%d\n",m);
}
return ;
}
hdu---------3189-------------------的更多相关文章
- hdu 3189(网络流+二分枚举)
Steady Cow Assignment Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6422 Accepted: ...
- 【转载】图论 500题——主要为hdu/poj/zoj
转自——http://blog.csdn.net/qwe20060514/article/details/8112550 =============================以下是最小生成树+并 ...
- hdu图论题目分类
=============================以下是最小生成树+并查集====================================== [HDU] 1213 How Many ...
- HDU图论题单
=============================以下是最小生成树+并查集====================================== [HDU] 1213 How Many ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
- HDU 1796How many integers can you find(容斥原理)
How many integers can you find Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d ...
随机推荐
- response对象学习
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpSer ...
- springboot使用过程中遇到的问题
一.工具Intellij IDEA 二.基本问题 1.数据库语句 Caused by: java.lang.IllegalStateException: Cannot load driver clas ...
- google --SwitchyOmega and switchysharp ***
https://github.com/FelisCatus https://chrome.google.com/webstore/search/Proxy%20SwitchySharp%20?hl=z ...
- R-Tree空间索引算法的研究历程和最新进展分析
转自原文 R-Tree空间索引算法的研究历程和最新进展分析,2008 摘要:本文介绍了空间索引的概念.R-Tree数据结构和R-Tree空间索引的算法描述,并从R-Tree索引技术的优缺点对R-Tre ...
- java.net.URISyntaxException的解决办法
java.net.URISyntaxException的解决办法 近日在用HttpClient访问抓取汇率时,为了省力,直接采用 String url = "http://api.liqwe ...
- burpsuite破解版
来源:http://www.vuln.cn/8847
- 【转载】epoll与select/poll的区别总结
因为这道题目经常被问到.干脆总结一下,免得遗漏了. 参考文章:http://www.cnblogs.com/qiaoconglovelife/p/5735936.html 1 本质上都是同步I/O 三 ...
- 2003 -Can't connection to mysql server on | navicat for mysql Access denied for user 'root'@''ip'(using password :yes)
用本机windows上的Navicat for mysql链接虚拟机Linux的mysql数据库时,第一次连接的时候报的错误是 2003 -Can't connection to mysql serv ...
- Android时时监測手机的旋转角度 依据旋转角度确定在什么角度载入竖屏布局 在什么时候载入横屏布局
一.场景描写叙述: 最近开发中遇到个问题,就是我们在做横竖屏切换的功能时.横竖屏布局是操作系统去感知的,作为开发员没法确定Activity在什么时候载入横屏布局,在什么时候载入竖屏布局.因此为了找到载 ...
- mysql中“Table ‘’ is read only”的解决办法
之前是在linux下面直接Copy的data下面整个数据库文件夹,在phpMyAdmin里面重新赋予新用户相应权限后,drupal成功连接上数据库.但出现N多行错误提示,都是跟Cache相关的表是‘R ...