热门

最新

红包

立Flag

投票

同城

我的

发布
qq_44124775
茗茶雨熙
4 年前
trueqq_44124775

求助啊啊啊啊啊啊啊啊啊啊啊啊 买了个云服务器 他自带有cifar10 但是我无论把它移到哪 为什么运行时都要下载 我应该怎么办

你问我答
CSDN App 扫码分享
分享
2
点赞
打赏
  • 复制链接
  • 举报
下一条:
#include <iostream>#include <string.h>using namespace std;int main(){ char sub[100],str[100]; int i=0,j=-1; int Next[100]; Next[0]=-1; gets(str); gets(sub); while(sub[i]!=0) { if(j==-1||sub[i]==sub[j]) { i++; j++; Next[i]=j; } else { j=Next[j]; } } i=0; j=0; while(i<strlen(str)&&j<strlen(sub)) { if(str[i]==sub[j]||(j==-1)) { i++; j++; } else { j=Next[j]; } } if(j==strlen(sub)) cout<<"子串在母串中的位置是"<<i-strlen(sub); else cout<<"无"; return 0;}有没有好心人帮我看看这个kmp代码为什么不对
立即登录