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 ...
随机推荐
- Building clang on RedHat
http://btorpey.github.io/blog/2015/01/02/building-clang/ clang is a great compiler, with a boatload ...
- sql 2005 安装
http://blog.csdn.net/wochuailimin/article/details/6120462 http://www.cnblogs.com/huangcong/archive/2 ...
- MySQL入门笔记 - 数据类型
参考书籍<MySQL入门很简单> 数据类型是数据的一种属性,可以决定数据的存储方式.有效范围和相应的限制. 1.整数类型 1.1 MySQL的整数类型 MySQL中int类型和inte ...
- 查看linux接口进出口流量的命令;linux 网络监控;流量监控
1.nload,左右键切换网卡 2.sudo iftop 3.sudo iptraf 按连接/端口查看流量 4.sudo nethogs: 按进程查看流量占用 5.ss: 连接查看工具 6.dstat ...
- C++设计模式之适配器模式(二)
3.Socket网络通信的设计与实现------类适配器 除了对象适配器模式之外.适配器模式另一种形式.那就是类适配器模式,类适配器模式和对象适配器模式最大的差别在于适配器和适配者之间的关系不同,对象 ...
- 小心入怀Yaf
http://www.laruence.com/2015/05/14/3021.html, 鸟哥文章 看了这个文章,更加要小心的对待 Yaf Yar 框架了. 不正确 glib 有一定的了解进来就是深 ...
- 原来,表名和字段名不能在pdo中“参数化查询”
https://stackoverflow.com/questions/182287/can-php-pdo-statements-accept-the-table-or-column-name-as ...
- 微信小程序之 SideBar(侧栏分类)
项目目录: 模拟数据: utils / data.js function getSData() { var data = [ { "id": 1, "tree" ...
- 数据库分表和分库的原理及基于thinkPHP的实现方法
为什么要分表,分库: 当我们的数据表数据量,訪问量非常大.或者是使用频繁的时候,一个数据表已经不能承受如此大的数据訪问和存储,所以,为了减轻数据库的负担,加快数据的存储,就须要将一张表分成多张,及将一 ...
- Web开发从零单排之一:在新浪云平台SAE上开发一个html5电子喜帖
需求描述: 本人大婚将至,女朋友说“现在都流行在微信上发电子请帖了,你不是技(cheng)术(xu)宅(yuan)嘛,不会连这个都搞不定吧” 本人嘴上说这等小事何足挂齿,但心里还是七上八下的,虽然自认 ...