poj1035 Spell checker
这题目比较简单,把思路搞清楚就可以啦。
#include <stdio.h>
#include <string.h>
char words[+][]; int init(){
int cnt=;
while(~scanf("%s",words[cnt])){
if(strcmp("#",words[cnt])==) return cnt;
cnt++;
}
}
int judge(char a[],char b[]){
int success;
int la=strlen(a);
int lb=strlen(b);
int i,j,k;
int cnt=;
if(la==lb){
for(i=;i<la;++i)
if(a[i]!=b[i])
cnt++;
if(cnt==) return ;
} if(la==lb+)
for(i=;i<la;++i){
success=;
for(j=,k=;j<la&&k<lb;){
if(j==i){
j++;continue;
}
if(a[j]!=b[k]){
success=;
}
j++;k++;
}
if(success==) return ;
}
if(la+==lb)
for(i=;i<lb;++i){
success=;
for(j=,k=;j<la&&k<lb;){
if(k==i){
k++;continue;
}
if(a[j]!=b[k]){
success=;
}
j++;k++;
}
if(success==) return ;
}
return ;
} void done(int cnt){
char tmp[];
int i;
int success;
while(~scanf("%s",tmp)){
if(strcmp(tmp,"#")==)
return;
success=;
for(i=;i<cnt;++i){
if(strcmp(words[i],tmp)==){
printf("%s is correct\n",tmp);
success=;
break;
}
}
if(success==)
continue;
printf("%s:",tmp);
for(i=;i<cnt;++i){
if( judge(words[i],tmp)==){
printf(" %s",words[i]);
}
}
printf("\n");
}
return ;
}
int main(){
done(init());
return ;
}
poj1035 Spell checker的更多相关文章
- POJ1035——Spell checker(字符串处理)
Spell checker DescriptionYou, as a member of a development team for a new spell checking program, ar ...
- Spell checker
Spell checker Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Subm ...
- poj 1035 Spell checker
Spell checker Time Limit: 2000 MS Memory Limit: 65536 KB 64-bit integer IO format: %I64d , %I64u J ...
- Spell checker(暴力)
Spell checker Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 20188 Accepted: 7404 De ...
- poj 1035 Spell checker ( 字符串处理 )
Spell checker Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 16675 Accepted: 6087 De ...
- [ACM] POJ 1035 Spell checker (单词查找,删除替换添加不论什么一个字母)
Spell checker Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 18693 Accepted: 6844 De ...
- Spell checker POJ 1035 字符串
Spell checker Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 25426 Accepted: 9300 De ...
- POJ 1035:Spell checker
Spell checker Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 22574 Accepted: 8231 De ...
- Code Spell Checker & VSCode 单词拼写验证
Code Spell Checker & VSCode 单词拼写验证 https://marketplace.visualstudio.com/items?itemName=streetsid ...
随机推荐
- mysql 正则
mysql 正则学习 基本字符匹配 select desk from dealer_info where desk regexp "82107777"; . 表示匹配任意一个字符 ...
- JDK动态代理与Cglib库
JDK动态代理 代理模式是常用的java设计模式,他的特征是代理类与委托类有同样的接口,代理类主要负责为委托类预处理消息.过滤消息.把消息转发给委托类,以及事后处理消息等.代理类与委托类之间通常会存在 ...
- CentOS安装apache2(转载)
From:http://www.onepx.com/centos-apache-246.html 之前服务器 Apache 版本一直是 2.2.x,鉴于 Centos 更新软件的惰性,我看直到 201 ...
- Getting started with SciPy for .NET
Getting started with SciPy for .NET 1.) IronPython Download and install IronPython 2.7, this will re ...
- C语言中fseek函数
C语言fseek()函数:用来设定文件的当前读写位置 头文件: #include <stdio.h> 定义函数: int fseek(FILE * stream, long offset, ...
- [ActionScript 3.0] Away3D 非skybox的全景例子
package { import away3d.containers.View3D; import away3d.controllers.HoverController; import away3d. ...
- 一个类似bootstrap的foundation
提供了和BOOTSTRAP一样的功能,但明显比bootstrap有更好的效果 比如 <button> 直接就添加了样式了. http://www.foundcss.com/ Bootstr ...
- Java SE 第二十三讲----static关键字and final关键字
1.static关键字 [在二十二讲视频中30分钟开始讲授] 2.static修饰属性:无论一个类生成了多少个对象,所有这些对象共同使用唯一一份静态的成员变量:一个对象对该静态成员变量进行了修改,其他 ...
- XXX项目 android 开发笔记
1 工具? eclipse or android studio fragment 套用
- [ACDream 1430]SETI 后缀数组
题目链接:http://acdream.info/problem?pid=1430 题目大意:给你一个长度不超过10000的字符串,问你出现过两次或两次以上的不重叠的子串有多少个. 后缀数组计算出he ...