单词拼写检查
来源:互联网 发布:ubuntu怎么打开软件 编辑:程序博客网 时间:2024/05/22 09:12
哈希表。。没什么技巧。核心是取字符串首、中、尾的字符进行HASH()
#include<iostream>#include<string>using namespace std;const int maxn=1123357;int total;string h[maxn+1];int hash(string x){int t,l,m;l=x.length();m=l/2;t=(x[0]-65)*10000+(x[m]-65)*100+(x[l-1]-65);return t%maxn;}void init(string x){int t=hash(x);while(h[t]!=""&&h[t]!=x){t++;if(t==maxn) t=0;}h[t]=x;}void find(string x){int t=hash(x);while(h[t]!=""&&h[t]!=x){t++;if(t==maxn) t=0;}if(h[t]=="") total++;}int main(void){int i,n,m;string wrd;total=0;cout<<"请输入单词库的单词数:";cin>>n;cout<<"请输入单词:";for(i=1;i<=n;i++){cin>>wrd;init(wrd);}cout<<"请输入待查单词数:";cin>>m;cout<<"请输入待查单词:";for(i=1;i<=m;i++){cin>>wrd;find(wrd);}cout<<"单词拼错数:";cout<<total;return 0;}
0 0
- Emacs 单词拼写检查
- 单词拼写检查笔记
- 单词拼写检查
- 单词拼写检查
- 单词拼写检查
- 【Eclipse】关闭单词拼写检查
- 使用Eclipse的单词拼写检查功能
- 单词拼写检查器 C++实现
- vim中单词拼写检查spellchecking
- myeclipse 取消对单词的拼写检查
- 拼写检查
- 拼写检查
- windows下使用aspell开启emacs的单词拼写检查功能
- 单词拼写纠错
- AS SpellCheck拼写检查
- Hunspell拼写检查器
- 拼写检查设计
- 插件8:拼写检查
- unity游戏性能优化之渲染优化
- 回首2016,展望2017
- Spring AOP源码研究笔记
- Vmware 下最小化安装 centso7
- (外网链接内容)Unity3D研究院编辑器之5.3JSON的序列化
- 单词拼写检查
- CodeForces 478C Table Decorations 思维题
- easyUI中datagrid的column属性的介绍
- Nginx出现413 Request Entity Too Large错误解决方法
- 【SDOI2010】bzoj1941 Hide and Seek
- 【填空题】二进制串转十进制整数
- 【NOIP2014模拟8.25】地砖铺设
- android不能滚动
- 4381: [POI2015]Odwiedziny