Hamming Problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1305 Accepted Submission(s): 583 Problem Description For each three prime numbers p1, p2 and p3, let's define Hamming sequence Hi(p1…
题意: For each three prime numbers p1, p2 and p3, let's define Hamming sequence Hi(p1, p2, p3), i=1, ... as containing in increasing order all the natural numbers whose only prime divisors are p1, p2 or p3. For example, H(2, 3, 5) = 2, 3, 4, 5, 6, 8, 9…
Hamming Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 595    Accepted Submission(s): 247 Problem Description For each three prime numbers p1, p2 and p3, let's define Hamming sequence…
HDU 3549 Flow Problem(最大流) Time Limit: 5000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) [Description] [题目描述] Network flow is a well-known difficult problem for ACMers. Given a graph, your task is to find out the maximum flow for t…
题目链接:hdu 5106 Bits Problem 题目大意:给定n和r,要求算出[0,r)之间全部n-onebit数的和. 解题思路:数位dp,一个ct表示个数,dp表示和,然后就剩下普通的数位dp了.只是貌似正解是o(n)的算法.可是n才 1000.用o(n^2)的复杂度也是够的. #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long…
HDU 3374 String Problem (KMP+最大最小表示) String Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1602    Accepted Submission(s): 714 Problem Description Give you a string with length N, you c…
pid=5105" target="_blank" style="">题目链接:hdu 5105 Math Problem 题目大意:给定a.b,c,d.l,r.表示有一个函数f(x)=|a∗x3+b∗x2+c∗x+d|(L≤x≤R),求函数最大值. 解题思路:考虑极点就可以,将函数求导后得到f′(x)=0的x,即为极值点.在极值点处函数的单调性会发生变化,所以最大值一定就在区间边界和极值点上.注意a=0.b=0的情况,以及极值点不在区间上. #in…
题目链接: Hdu  5445 Food Problem 题目描述: 有n种甜点,每种都有三个属性(能量,空间,数目),有m辆卡车,每种都有是三个属性(空间,花费,数目).问至少运输p能量的甜点,花费最小是多少? 解题思路: 明显可以看出是多重背包搞两次,但是数据范围太大了,背包要到2*1e6,感觉会TLe.还是呆呆的写了一发,果断超啊!然后滚回去看背包九讲课件了,看到了二进制压缩的时候,感觉可以搞这个题目.试了一下果然AC,原本物品数目是100*100,二进制压缩以后也就是100*log210…
网络流 HDU 3549 Flow Problem 题目:pid=3549">http://acm.hdu.edu.cn/showproblem.php?pid=3549 用增广路算法进行求解.注意的问题有两个: 1. 每次增广的时候,反向流量也要进行更行.一開始没注意,WA了几次 ORZ 2. 对于输入的数据,容量要进行累加更新. // 邻接矩阵存储 #include <bits/stdc++.h> using namespace std; const int INF = 0…
题目链接: Hdu 5371 Hotaru's problem 题目描述: 给出一个字符串N,要求找出一条N的最长连续子串.这个子串要满足:1:可以平均分成三段,2:第一段和第三段相等,3:第一段和第二段回文. 解题思路: 其实通俗来讲就是求符合题意的最长回文串.先用manacher与处理一下字符串N,得出以n[i]与n[i+1]为中心的回文串长度半径记为p[i],然后循环枚举i作为第一段的终点,p[i]+i-1作为第二段的终点记做j.当p[i]>=(j-i+1)&&p[j]>…