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 ...
随机推荐
- 设置presentVC跟PushVC一样的效果即从右到左的动画
SettingViewController *VC = [[SettingViewControlleralloc]init]; VC.view.backgroundColor = [UIColorwh ...
- Android开发者需要面对的8大挑战
移动开发变得越来越受欢迎,但移动开发者正面临着一系列挑战.本文将介绍的是Android开发者需要面对的8个不利因素,例如缺乏硬件标准化,以及软件碎片.为Android OS开发app,给予了开发人员极 ...
- win7系统安装
系统之家地址:http://www.ghostxp3.com/ Ylmf_Ghost_Win7_x64_CJB_V2016.iso
- 理论沉淀:RANSAC算法
1.解决问题: 当一组样本数据中含有(较小波动的)正常数据(inliers)和(较大波动的)异常数据(outliers)且异常数据的量还不小于正常数据的量时,用最小二乘法将难以获得期望的直线(即能拟合 ...
- C++primer练习14.44
编写一个简单的桌面计算器使其处理二元运算 // 14_44.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include<iost ...
- (easy)LeetCode 228.Summary Ranges
Given a sorted integer array without duplicates, return the summary of its ranges. For example, give ...
- linux创建用户和用户组
Linux创建用户.用户组 及 删除 在创建用户时,需要为新建用户指定一用户组,如果不指定其用户所属的工作组,自动会生成一个与用户名同名的工作组.创建用户user1的时候指定其所属工作组users,例 ...
- 导出api文档
Export,选中项目或者需要导出api的类,右键 java-->javadoc configure,选择C:\Program Files\Java\jdk1.6.0_29\bin\javado ...
- archlinux log 文件查看
# pacman -S gnome-system-log gnome-logsextra/gnome-logs 3.12.1-1 (gnome-extra) A log viewer for the ...
- ibatis cannot find <sql> pattern
"Could not find SQL statement to include with refid xxx"A: 认真把每个用到xxx的地方都看一遍