poj2503】的更多相关文章

Babelfish DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them.InputInput consists of up to 100,000 diction…
题目链接: https://vjudge.net/problem/POJ-2503 题目大意: 就像查找一本字典,根据输入的条目和要查询的单词,给出查询结果(每个单词长度不超过10) 解题思路: map容器可以直接过,不过为了练习hash,写了个hash也可以过 #include<iostream> #include<cstdio> #include<cstring> #include<string> #include<map> #include…
此代码原始出处:http://blog.csdn.net/cnyali/article/details/47367403 #include<stdio.h> #include<string.h> #include<stdlib.h> struct node{ char word[15]; int count; struct node *next[30]; node(){ count=0; memset(next,0,sizeof(next)); } }; void in…
POJ2503 这是一道水题,用Map轻松AC. 不过,可以拿来测一下字符串散列, 毕竟,很多情况下map无法解决的映射问题需要用到字符串散列. 自己生成一个质数, 随便搞一下. #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<string.h> #include<cmath> #include<vector>…
这题目主要是难在字符串处理这块. #include <stdio.h> #include <string.h> #include <stdlib.h> #define mod 999983 struct node{ +]; +]; node *next; }p[mod]; int sign[mod]; void hash(char str[],char res[]){ int i,l=strlen(str); ; ;i<l;++i) key=(key+str[i]…
Description You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them. Input Input consists of up to 100,000 dictionary ent…
题目链接. 分析: 应当用字典树,但stl的map做很简单. #include <iostream> #include <cstdio> #include <cstdlib> #include <string> #include <algorithm> #include <vector> #include <map> #include <cstring> #include <queue> using…
有关字符串的hash,用黑书上推荐的传说中的ELFhash函数 输入的话,用sscanf处理比較简洁 #include<iostream> #include<cstring> using namespace std; #define M 9991 struct n1 { char foreigh[11],english[11]; n1 *next; }; n1 hash[M]; int ELFhash(char *key) { long long g,h=0; while(*key…
Babelfish Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 41263   Accepted: 17561 Description You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have…
                                                                                                                                                             Babelfish Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 44537   Accepted: 1880…