HDU 1058(打表)】的更多相关文章

题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1058 Humble Numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 29253    Accepted Submission(s): 12809 Problem Description A number whose only…
Humble Numbers Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1058 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9…
HDOJ(HDU).1058 Humble Numbers (DP) 点我挑战题目 题意分析 水 代码总览 /* Title:HDOJ.1058 Author:pengwill Date:2017-2-15 */ #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #define nmax 6000 #define min(a,b) (a<b?a:b…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1058 解题报告:输入一个n,输出第n个质因子只有2,3,5,7的数. 用了离线打表,因为n最大只有5842. #include<stdio.h> #define INT __int64 INT ans[] = { ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,…
http://acm.hdu.edu.cn/showproblem.php?pid=4542 给出一个数K和两个操作 如果操作是0,就求出一个最小的正整数X,满足X的约数个数为K. 如果操作是1,就求出一个最小的X,满足X的约数个数为X-K. 对于操作0,分析见这里,搜索需要有力剪枝.对于操作1,代表1至X中不是X的约数个数为K,看似还是搜索,但是由于时限卡的丧心病狂...所以用打表完成 d[i]先用来表示i的约数个数,然后可以模仿素数打表,对于每个数的每个倍数,其d值都自减1,这样就求出每个i…
http://acm.hdu.edu.cn/showproblem.php?pid=1223 一般遇到这些题,我都是暴力输出前几项,找规律.未果. 然后输出n = 1时候,以A开始,有多少个答案, n = 2的时候,A开始,B开始,有多少个答案.然后发现了规律.大数之 + ; struct node { int val; int id; bool operator < (const struct node & rhs) const { if (val != rhs.val) return v…
这题应该是用dp来做的吧,但一时不想思考了,写了个很暴力的,类似模拟打表,然后排序即可,要注意的是输出的格式,在这里wa了一发,看了别人的代码才知道哪些情况没考虑到. #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #define For(i,s,t) for(int i=s; i<=t; ++i) using namespace std; typedef l…
思路:直接打表 #include<cstdio> #include<vector> #include<cmath> #include<iostream> using namespace std; ]={,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,…
BC # 32 1002 题意:给出一个数组 a 和一个数 K ,问是否存在数对( i , j ),使 a i   - a i + 1 +……+ (-1)j - i  a j : 对于这道题,一开始就想到了是前缀和,但是如果只是记录下前缀和数组,那么查找就会成为一个大问题.补题的时候一开始考虑用 hash 数组或者是 set 存,但是很明显 TLE 了,在翔神的推荐下,我研究了一下 hash表的创建过程,惊奇地发现,其实就是建了一个 HashMap 结构体,而里面放了这个表所用的数组以及相应操作…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4715 思路:先打个素数表,然后判断一下就可以了. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using namespace std; ]; ]; int main() { ; memset(isprime,true…