在输入的单词中删除或替换或插入一个字符,看是否在字典中.直接暴力,172ms.. #include <stdio.h> #include <string.h> ]; ][], s[]; bool del(char s1[], char s2[]) { ; , j = ; s1[i] && s2[j]; i++, j++) { if(s1[i] != s2[j]) { if(isdel) ; j--; isdel = ; } } ; } bool rep(char s…
Spell checker Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 16675   Accepted: 6087 Description You, as a member of a development team for a new spell checking program, are to write a module that will check the correctness of given word…
Spell checker Time Limit: 2000 MS Memory Limit: 65536 KB 64-bit integer IO format: %I64d , %I64u   Java class name: Main [Submit] [Status] [Discuss] Description You, as a member of a development team for a new spell checking program, are to write a m…
Spell checker Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 18693   Accepted: 6844 Description You, as a member of a development team for a new spell checking program, are to write a module that will check the correctness of given word…
题目链接 Description You, as a member of a development team for a new spell checking program, are to write a module that will check the correctness of given words using a known dictionary of all correct words in all their forms. If the word is absent in…
题目 http://poj.org/problem?id=1035 题意 字典匹配,单词表共有1e4个单词,单词长度小于15,需要对最多50个单词进行匹配.在匹配时,如果直接匹配可以找到待匹配串,则直接输出正确信息,否则输出所有满足以下条件的单词: 1. 待匹配串删除任意一个字符后可以匹配的 2. 单词删除任意一个字符后可以匹配的 3. 把待匹配串中某个字符改为单词对应字符后可以匹配的 思路由于单词表容量较小,直接匹配可以直接使用strcmp进行.若直接匹配不成功,那么需要对每个单词进行再次比较…
题目:http://poj.org/problem?id=1035 还是暴搜 #include <iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<stack> #include<queue> #include<iomanip> #include<cmath> #include<map> #include&…
题目链接:http://poj.org/problem?id=1035 思路分析: 1.使用哈希表存储字典 2.对待查找的word在字典中查找,查找成功输出查找成功信息 3.若查找不成功,对word增.删.改处理,然后在字典中查询,若查找成功则记录处理后单词在字典中的次序 4.对次序排序再输出 注:对word处理后可能会出现重复,需要进行判断重 代码如下: #include <iostream> using namespace std; ; ; char hashDic[tSize][N];…
题目网址:http://poj.org/problem?id=1035 思路: 看到题目第一反应是用LCS ——最长公共子序列 来求解.因为给的字典比较多,最多有1w个,而LCS的算法时间复杂度是O(n*m),n,m分别对应两个字符串的长度.还要乘上字典的个数和所要匹配的单词数,不出意外地..超时了. 后面就想到了暴力求解,直接枚举所有情况,先判断字符串长度差是否大于1,大于1的话直接进行下一个循环,否则再继续划分.(len对应字典词长度,l对应要查询的词长度) 假设匹配成功,只会有以下三种情况…
字典树. #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <vector> #include <string> using namespace std; typedef struct Trie { int in; Trie *next[]; } Trie; Trie root; ][]; ], nn; void c…