Login
Register
Problem list
Online status
RockyChen0205
:
2023-11-03 12:02:40
AC了,代码如下: #include
#include
using namespace std; int main(){ int n; cin>>n; vector
> next; for(int i=0;i
>temp; int size=temp.size(); vector
next_temp(size); next_temp[0]=-1; int k=-1; int j=0; while(j
ironman
:
2023-02-16 23:39:07
#include
using namespace std; int nexts[10000]; void kmp(string a) { int l = a.length(); int m = 0, n = -1; nexts[0] = -1; while (m < l) { if (n == -1 || a[m] == a[n]) { nexts[++m] = ++n; } else n = nexts[n]; } } int main() { int n; cin >> n; for (int i = 0; i < n; i++) { char c[10000]; cin >> c; kmp(c); for (int j = 0; j < strlen(c); j++) { cout << nexts[j] << " "; } } } 我自己做的那些测试的答案和给的答案一样的啊?就是编译错误不理解啊?
cairui
:
2021-06-20 01:41:57
Always RE. I'm tired out.
Post Your Comment