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 ...
随机推荐
- 异步SOCKET分包和组包的一种通用算法
unit uPackage;// 应用协议// cxg 2016-9-23// 包=包头+包体 interface uses SysUtils, Classes, PeachCtrl.Net.Iocp ...
- Reload file in vim
68down voteaccepted Give this a try: :e From :h :e: Edit the current file. This is useful to re-edit ...
- XMLHttpRequest对象解读
<!DOCTYPE html> <html> <body> <script> function reqListener () { console.log ...
- js中字符串的拼接的另一种方法
// 按一定长度截断字符串,并使用 + 运算符进行连接. // 分隔字符串尽量按语义进行,如不要在一个完整的名词中间断开. // 特别的,对于HTML片段的拼接,通过缩进,保持和HTML相同的结构. ...
- JIRA运行太慢,修改JVM
JIRA运行太慢,根据实际实况,修改JVM内存大小 2. 非NT服务修改JVM内存大小 修改%JIRA_HOME%/bin下面的setenv.bat文件,修改JAVA_OPTS这个环境变量 set J ...
- MongoDB 操作手冊CRUD 更新 update
改动记录 概述 MongoDB提供了update()方法用于更新记录. 这种方法接受下面參数: 一个更新条件的JSON对象用于匹配记录,一个更新操作JSON对象用于声明更新操作,和一个选项JS ...
- The Pilots Brothers' refrigerator-DFS路径打印
I - The Pilots Brothers' refrigerator Time Limit:1000MS Memory Limit:65536KB 64bit IO Format ...
- 网络知识: 物理层PHY 和 网络层MAC
PHY模块简介 物理层位于OSI最底层,物理层协议定义电气信号.线的状态.时钟要求.数据编码和数据传输用的连接器. 物理层的器件称为PHY. 上图里的灰色方框图里的就是PHY芯片内部模块图. MAC器 ...
- 使用word模板生成pdf文件
使用word模板生成pdf文件 源码:UserWord
- 发挥bat的作用
from 转自:http://blog.csdn.net/hitlion2008/article/details/7467252 1.什么是Windows BATCH BATCH也就是批处理文件,有时 ...