摘要: 题目链接:http://poj.org/problem?id=2503代码:#include#include#include#includeusing namespace std;const int maxn = 100050;const int HASH = 1000003;int head[HASH],next[maxn];char s1[maxn][15],s2[maxn][15];int n;int hash(char *s){ int ret = 0; int seed = 131; while(*s) { ret = ret * seed + ... 阅读全文
posted @ 2013-10-11 18:48 等待最好的两个人 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=970第一次正式用hash表。代码:#include#include#include#includeusing namespace std;const int maxn = 25500;const int HASH = 1000003;char s[maxn][20];int head[HASH],next[maxn];int dp[maxn];int n;char tem 阅读全文
posted @ 2013-10-11 16:22 等待最好的两个人 阅读(266) 评论(0) 推荐(0) 编辑