-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
62 lines (50 loc) · 1.12 KB
/
main.cpp
File metadata and controls
62 lines (50 loc) · 1.12 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <iostream>
using namespace std;
int Consolution(string s,int l,int r);
int main()
{
int n;
cout<<"ÊäÈëÒ»¸öÊý×Ö£º"<<endl;
cin>>n;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<"*";
}
cout<<endl;
/*string s="adfefa";
int max_len=0,start=0,end=0;
string ans;
if (s.size() < 1)
{
cout<<"";
}
for(int i=0;i<s.size();i++)
{
int len1=Consolution(s,i,i);
int len2=Consolution(s,i,i+1);
int len=max(len1,len2);
if(max_len<len)
{
max_len=len;
start = i - (len -1) / 2;
end = i + len / 2;
}
cout<<len<<" "<<start<<endl;
ans=s.substr(start+1,end-start-1);
}
cout<< ans;*/
}
}
int Consolution(string s,int left,int right)
{
int l=left;
int r=right;
while(l>=0 && r<s.size() && s[l]==s[r] )
{
r++;
l--;
}
return r-l+1;
}