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 ...
随机推荐
- EasyUI-draggable
draggable用来在界面上创建一个可以拖动的元素,既然是可以拖动的元素,那么它在拖动过程中会有下面的几个事件:onBeforeDrag.onStartDrag.onDrag.onStopDrag. ...
- iCheck表单美化插件使用方法详解(含参数、事件等)
iCheck 特色: 1.在不同浏览器(包括ie6+)和设备上都有相同的表现 - 包括 桌面和移动设备 2.支持触摸设备 - iOS.Android.BlackBerry.Windows Phon ...
- repo安装
repo是使用python开发的一个用于多版本管理的工具,可以和git协作,简化git的多版本管理. repo安装: 1.新建~/bin,并将此目录包含在path变量中(如果已存在,且已在path变量 ...
- asterisk中eyebeam与移动的IMS帐号对接
账号和密码: 05128068**** xbfldz6658****IP:120.195.9.148域名:ims.js.chinamobile.com 上图吧:
- QT中QWidget、QDialog QMainWindow
继承关系:在Qt中所有的类都有一个共同的基类QObject ,QWidget直接继承与QPaintDevice类,QDialog.QMainWindow.QFrame直接继承QWidget 类. QW ...
- 如何在组件(Component中)模拟用户控件(UserControl)中FindForm()?
using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentM ...
- isIsomorphic
超时版: /* Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if t ...
- strstr、strcmp、strlen、strcpy
const char* strstr(const char *str, const char* substr) { int i, j, temp; ; str[i] != '\0'; i++) { j ...
- Android--ListView显示列表数据
简单的显示 import android.os.Bundle; import android.app.ListActivity; import android.view.View; import an ...
- Library Cache: Lock, Pin and Load Lock
What is "Library cache lock" ? This event controls the concurrency between clients of the ...