hiho Week 3 register

Ended

Participants:669

Verdict:Accepted
Submitted:2014-07-20 20:18:33

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<iostream>
#include<string>
using namespace std;
string src[20]={""};
string par[20]={""};
int size=0;
void getNext(string s,int n[]){
    int len=s.length();
    n[0]=-1;
    n[1]=0;
    int i,k=0;
    for(i=2;i<=len;){
        if(s.substr(i-k-1,k+1)==s.substr(0,k+1)){
            k++;
            n[i]=k;
            i++;
        }else{
            if(k==0){
                n[i]=0;
                i++;
            }else{
                k=0;
            }
        }
    }
}
int getCountsOfEquStr(string src,string par){
    int *Next=new int[10001];
    getNext(par,Next);
    int i=0,l=src.length(),counts=0,parlen=par.length();
    int p=0,q=0;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX