上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 47 下一页

2012年5月31日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2716水题View Code #include <iostream>using namespace std ;int main(){ char key[27],mes[81] ; while(~scanf("%s%*c",key)) { gets(mes) ; for(int i=0;mes[i];i++) { if(mes[i]>='A'&&mes[i]<='Z') putchar(key[mes... 阅读全文
posted @ 2012-05-31 11:22 LegendaryAC 阅读(141) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2648stl的map直接建立映射View Code #include <iostream>#include <algorithm>#include <string>#include <map>using namespace std ;string name[10001];int main(){ int n; while(~scanf("%d",&n)) { for(int i=0;i<n;i++) cin >> na 阅读全文
posted @ 2012-05-31 00:38 LegendaryAC 阅读(356) 评论(0) 推荐(0) 编辑

2012年5月30日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3336求字符串的前缀在字符串中一共出现多少次。这个讲解的很清楚,传送门:http://972169909-qq-com.iteye.com/blog/1114968我用的思想是递推,把next数组向右平移一位,转移... 阅读全文
posted @ 2012-05-30 23:27 LegendaryAC 阅读(175) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2800View Code #include <iostream> using namespace std; int main(){ int n; while(scanf("%d",&n),n) printf("%d\n",(n+1)>>1); return 0;} 阅读全文
posted @ 2012-05-30 18:05 LegendaryAC 阅读(144) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2594好题,做完之后直接对KMP的理解提升一个档次。主要考察对_next数组含义的理解,之前的理解有点模糊,卡了两个半小时。View Code #include #include #include #include... 阅读全文
posted @ 2012-05-30 17:50 LegendaryAC 阅读(195) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1686求子串个数,可重复,直接上KMP模板View Code #include #include using namespace std ; int n,m;char a[1000002],b[10002];int... 阅读全文
posted @ 2012-05-30 14:22 LegendaryAC 阅读(154) 评论(0) 推荐(0) 编辑
 
摘要: AB串下标都从1开始,kmp函数返回第一次成功匹配的A串下标,把其中注释去掉可以匹配多个Next[i]表示位置长度为1-i的字符串最多有长度为Next[i]的前缀等于其后缀char A[1000005],B[1000005] ;int Next[1000005],lenA,lenB ;void Ge... 阅读全文
posted @ 2012-05-30 13:59 LegendaryAC 阅读(177) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1711终于炼化了kmp算法,就算是现在我仍然惊异于字符串匹配居然存在线性时间的算法这种超出了我这种sb认知的东西。自己搞了N久,发现还是没有网上的模板写的好,这里直接收藏了。View Code #include #... 阅读全文
posted @ 2012-05-30 13:45 LegendaryAC 阅读(168) 评论(0) 推荐(0) 编辑
 
摘要: 大家好,我就是一个连搜索都学不会的sb。学了这么久连搜索是何物都不知道,BISTUACM已经不需要我了,哦也。 阅读全文
posted @ 2012-05-30 12:11 LegendaryAC 阅读(166) 评论(1) 推荐(0) 编辑

2012年5月29日

摘要: 坑点:0特判View Code const double esp=1e-11;string ElectionFraudDiv2::IsFraudulent(vector <int> percentages) { vector <double> sb ; double sum=0; for (int i = 0 ; i < percentages.size() ; i++) { sum+=percentages[i]+0.0; sb.push_back(percentages[i]+0.0); } double sum1,sum2;... 阅读全文
posted @ 2012-05-29 23:56 LegendaryAC 阅读(176) 评论(0) 推荐(0) 编辑
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 47 下一页