poj 1035
来源:互联网 发布:国内的人工智能龙头股 编辑:程序博客网 时间:2024/05/01 15:17
暴力水过,79ms
#include <iostream>#include <cstdio>#include <cstring>using namespace std;char tx[10000+10][20];char s[20];int len[10000+10],loc[10000+10];int main(){ int i=0; while(scanf("%s",tx[i])) { if(strcmp(tx[i],"#")==0) break; len[i]=strlen(tx[i]); i++; } int tot=0,k,p,flag; while(scanf("%s",s)) { tot=0; if(strcmp(s,"#")==0) break; int j,le=strlen(s); for(j=0;j<i;j++) { flag=0; if(le==len[j]) { for(k=0;k<le&&flag<=1;k++) { if(s[k]!=tx[j][k]) flag++; } if(flag==0) break; else if(flag==1) loc[tot++]=j; } else if(le==(len[j]+1)) { flag=0; for(k=0,p=0;k<len[j]&&flag<=1;) { if(s[p]!=tx[j][k]) { flag++; p++; } else { p++; k++; } } if(flag<=1) loc[tot++]=j; } else if((le+1)==len[j]) { flag=0; for(k=0,p=0;p<le&&flag<=1;) { if(s[p]!=tx[j][k]) { flag++; k++; } else { p++; k++; } } if(flag<=1) loc[tot++]=j; } } if(j<i) printf("%s is correct\n",s); else { printf("%s:",s); for(k=0;k<tot;k++) printf(" %s",tx[loc[k]]); printf("\n"); } } return 0;}
- POJ 1035
- Poj 1035
- POJ 1035
- poj 1035
- poj 1035
- poj 1035
- poj 1035
- POJ 1035
- poj.1035
- poj-1035
- poj 1035
- poj 1035
- poj 1035
- POJ 1035
- POJ 1035
- poj 1035
- poj-1035-Spell checker
- poj 1035 Spell checker
- [Android算法] Android 随手指移动的ImageView
- python中获取目录下的文件数
- Linux 卸载
- windows编码约定
- Gamma函数
- poj 1035
- IOS自动化打包介绍
- jquery中的可见性过滤选择器
- Android 高手进阶教程(十四)之----Android Location的使用!!
- android进程间通信:使用AIDL
- 学习Gtkmm系列之七
- VFS与Ext2文件系统------《深入Linux内核架构》笔记
- jquery中的属性过滤选择器
- PreCreateWindow