View Code
1 #include2 #include 3 #include 4 using namespace std; 5 6 int hash[30]; 7 bool loc[20000000]; 8 char str[1000000]; 9 10 int main()11 {12 int n,m,cnt,sum,len,ans,i,j;13 while(scanf("%d%d",&n,&m)!=EOF)14 {15 memset(loc,0,sizeof(loc));16 memset(hash,0,sizeof(hash));17 scanf("%s",str);18 len=strlen(str);19 cnt=1;20 ans=0;21 for(i=0;i+n<=len;i++)22 {23 sum=0;24 for(j=i;j
View Code
1 //TLE,搞成单次输入也TLE,也许字符种类数没有用上 2 //Huge input,scanf is recommended. 3 #include4 #include 5 #include 6 using namespace std; 7 8 int main() 9 {10 int i,j,k,T;11 int m,n;12 string s;13 set sset;14 while(cin>>m>>n)15 {16 s.clear();17 sset.clear();18 cin>>s;19 int len = s.length();20 for(i=0;i<=len-m;i++)21 {22 string temp = s.substr(i,m);23 sset.insert(temp);24 }25 cout< <
View Code
1 //tle 2 #include3 #include 4 #include 5 #include 6 using namespace std; 7 8 char str[16000010] ; 9 char hash[300];10 11 int main()12 {13 int n,m,sum,len;14 int i,j,k,t;15 set sset;16 while(scanf("%d%d",&n,&m)==2)17 { 18 memset(str,0,sizeof(str));19 memset(hash,0,sizeof(hash));20 sset.clear();21 scanf("%s",str);22 int cnt = 1;23 for(i=0;str[i+n-1]!='\0';i++)//不用strlen是为节省时间 24 {25 sum=0;26 for(j=i;j
View Code
1 #include2 #include 3 #include 4 #include