
hdu
lkbsbird
这个作者很懒,什么都没留下…
展开
-
hdu 1503
题意:给定两个字符串,合并成一个字符串,合并成的这个字符串同时也能分解成原来的两个字符串。 解析:使用DP(LCS最长公共子序列),使用标记,不同的状态,用不同的标记,将公共的字符输出一次即可。 #include #include #include #include using namespace std; const int maxn=1009; int dp[maxn][maxn]; in原创 2016-07-12 17:05:11 · 374 阅读 · 0 评论 -
hdu: 4287
Problem Description We all use cell phone today. And we must be familiar with the intelligent English input method on the cell phone. To be specific, the number buttons may correspond to some Engli原创 2016-07-07 17:01:10 · 267 阅读 · 1 评论 -
hdu 2600
题意:首先给一个大的区间,下面再给一些小区间,求在这些小区间外的最大值。 解析:根据小区间,把大区间划分开来,即算得最大值,(事先排个序) #include #include #include #include using namespace std; const int maxn=7000009; char s[3123]; int as[maxn]; struct node {原创 2016-07-18 19:19:21 · 359 阅读 · 0 评论 -
hdu 1002
求:a+b#include #include #include #include using namespace std; const int maxn=100009; char s1[maxn]; char s2[maxn]; char temp1[maxn]; char temp2[maxn]; char sum[maxn+2]; int main() { int t; sca原创 2016-07-07 21:51:54 · 227 阅读 · 0 评论 -
hdu 4099 Revenge of Fibonacci 字典树+斐波拉契数列数列
题意:给你N个数,让你查找是不是前100000个斐波拉契数列的前40位,如果是,那就输出下标最小的那个斐波拉契数列数列的下标。 解析:主要是通过trie树来进行,插入和查询,即将前100000个斐波拉契数和下标插入trie树中,然后通过查询输出下标即可(个别细节自己考虑下),现在的关键是如何插入100000个斐波拉契数列(只要前40位),准确的是怎么求这么大的数据(详细见Numinit()函数)原创 2016-07-08 10:11:44 · 457 阅读 · 0 评论 -
hdu 1019
题意:求M个数 的最小公倍数 #include #include #include using namespace std; const int maxn=1000009; long long g[maxn]; int n; int m; long long gcd(long long a,long long b) { return b ? gcd(b,a%b):a; } int mai原创 2016-07-21 09:41:42 · 264 阅读 · 0 评论 -
hdu 5742
题意:求a1+a2/a1+a2+..+an的最大值,其中只给出部分值,ax=y; #include #include #include #include using namespace std; const int maxn=109; int t; int n,m; int a[maxn]; int gcd(int a,int b) { return b ? gcd(b,a%b):a;原创 2016-07-22 08:27:49 · 444 阅读 · 0 评论 -
hdu 题目分类
基础题: 1000、1001、1004、1005、1008、1012、1013、1014、1017、1019、1021、1028、1029、1032、1037、1040、1048、1056、1058、1061、1070、1076、1089、1090、1091、1092、1093、1094、1095、1096、1097、1098、1106、1108、1157、1163、1164、1170、1194转载 2016-07-22 08:43:55 · 686 阅读 · 0 评论 -
hdu 5744
题意:给出字符的个数,组成回文串,找回文串中最小值的最大值。 解析:将奇数分成1和2,分别统计1和2的个数,判断下就出来了。 #include #include #include #include using namespace std; const int maxn=100009; int b[maxn]; int a[maxn]; int t,n; bool cmp(int a,int b原创 2016-07-22 08:35:45 · 429 阅读 · 0 评论 -
hdu:1305
Problem Description An encoding of a set of symbols is said to be immediately decodable if no code for one symbol is the prefix of a code for another symbol. We will assume for this problem that all原创 2016-07-07 11:22:22 · 271 阅读 · 0 评论 -
hdu:1247 Hat’s Words
Problem Description A hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary. You are to find all the hat’s words in a dictionary. Input原创 2016-07-06 20:52:23 · 166 阅读 · 0 评论 -
hdu:1556 Just a Hook
#include #include #include using namespace std; const int maxn=2100010; int t,n,q; int sum[maxn*4],mar[maxn]; void build(int l,int r,int i) { mar[i]=0; if(l==r) { sum[i]=1;原创 2016-07-05 22:18:23 · 190 阅读 · 0 评论 -
hdu 2473
题意:给你一些相连的两点(带传递,显然是集合),并会对某些点进行删除操作,最终问你集合的数目 解析:删除某个节点时,不是将与此节点所有关系都删除,只是将此节点隐藏, 别的结点的父节点还可以是此节点,用rep【】表示修改后的结点,例如, 原来结点是1、2、3,删除2结点,最后的1、2、3结点经rep【1、2、3】后 存的虚结点为1、4、3;即删除的结点用rep【i】=n++;然后看最终合原创 2016-07-02 14:42:30 · 247 阅读 · 0 评论 -
hdu 2955
题意:有几组测试用例,第一个小数,表示抢劫犯被抓的概率p,第二个数N表示下面有N个银行,下面N行,每行第一个数表示银行有多少钱,第二个数表示能抓住抢劫犯的概率。求在不被抓住的情况下能抢到最多的钱 解析:求反概率,即不被抓住的概率 #include #include #include #include using namespace std; const int maxn=10009; floa原创 2016-07-15 11:14:11 · 231 阅读 · 0 评论 -
hdu 5752
题意:求能否在5次开根号,回到1(水题) #include #include #include #include using namespace std; const int maxn=10009; char s[maxn]; int main() { while(scanf("%s",s)!=EOF) { int len=strlen(s); i原创 2016-07-26 17:40:29 · 341 阅读 · 0 评论 -
hdu 2191
Input 输入数据首先包含一个正整数C,表示有C组测试用例,每组测试用例的第一行是两个整数n和m(1 Output 对于每组测试数据,请输出能够购买大米的最多重量,你可以假设经费买不光所有的大米,并且经费你可以不用完。每个实例的输出占一行。 Sample Input 1 8 2 2 100 4 4 100 2 Sample Output 400#inc原创 2016-07-15 16:33:21 · 350 阅读 · 0 评论 -
hdu 2710
题意:求一个数的最大素数因子 #include #include #include #include using namespace std; const int maxn=221009; int a[maxn]; int b[maxn]; int t,n; int main() { memset(a,0,sizeof(a)); a[0]=0; a[1]=1; f原创 2016-07-15 19:40:27 · 327 阅读 · 0 评论 -
hdu 1423(最长公共上升子序列)
#include #include #include #include using namespace std; const int maxn=1009; int a[maxn]; int b[maxn]; int dp[maxn]; int t,n,m; int main() { scanf("%d",&t); getchar(); while(t--) {原创 2016-07-16 09:06:36 · 308 阅读 · 0 评论 -
hdu:1556
Problem Description N个气球排成一排,从左到右依次编号为1,2,3….N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽”牌电动车从气球a开始到气球b依次给每个气球涂一次颜色。但是N次以后lele已经忘记了第I个气球已经涂过几次颜色了,你能帮他算出每个气球被涂过几次颜色吗?Input 每个测试实例第一行为一个整数N,(N <= 100000).接下来的N原创 2016-07-05 16:42:26 · 168 阅读 · 0 评论 -
hdu:1754
Problem Description 很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input 本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0#include<cst原创 2016-07-05 10:44:30 · 238 阅读 · 0 评论 -
hdu 5666
题意:求x+y=q与坐标轴围成的三角形中,有多少个整数点坐标(不包括边界) 解析:注意数据很大,要用到快速乘 #include #include #include #include using namespace std; typedef long long ll; long long q,p; int t; ll qmul(ll a,ll b,ll m) { ll ans=0;原创 2016-07-22 11:20:08 · 262 阅读 · 0 评论