下沙友好群暑假训练二

转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud

A - Palindromes

Description

Friday is Polycarpus‘ favourite day of the week. Not because it is followed by the weekend, but because the lessons on Friday are 2 IT lessons, 2 math lessons and 2 literature lessons. Of course, Polycarpus has prepared to all of them, unlike his buddy Innocentius. Innocentius spent all evening playing his favourite game Fur2 and didn‘t have enough time to do the literature task. As Innocentius didn‘t want to get an F, he decided to do the task and read the book called "Storm and Calm" during the IT and Math lessons (he never used to have problems with these subjects). When the IT teacher Mr. Watkins saw this, he decided to give Innocentius another task so that the boy concentrated more on the lesson and less — on the staff that has nothing to do with IT.

Mr. Watkins said that a palindrome is a string that can be read the same way in either direction, from the left to the right and from the right to the left. A concatenation of strings ab is a string ab that results from consecutive adding of string b to string a. Of course, Innocentius knew it all but the task was much harder than he could have imagined. Mr. Watkins asked change in the "Storm and Calm" the minimum number of characters so that the text of the book would also be a concatenation of no more than k palindromes. Innocentius can‘t complete the task and therefore asks you to help him.

Input

The first input line contains a non-empty string s which is the text of "Storm and Calm" (without spaces). The length of the string s does not exceed 500 characters. String s consists of uppercase and lowercase Latin letters. The second line contains a single number k (1 ≤ k ≤ |s|, where |s| represents the length of the string s).

Output

Print on the first line the minimum number of changes that Innocentius will have to make. Print on the second line the string consisting of no more than k palindromes. Each palindrome should be non-empty and consist of uppercase and lowercase Latin letters. Use the character "+" (ASCII-code 43) to separate consecutive palindromes. If there exist several solutions, print any of them.

The letters‘ case does matter, that is an uppercase letter is not considered equivalent to the corresponding lowercase letter.

Sample Input

Input

abacaba1

Output

0abacaba

Input

abdcaba2

Output

1abdcdba

Input

abdcaba5

Output

0a+b+d+c+aba

Input

abacababababbcbabcd3

Output

1abacaba+babab+bcbabcb

水dp

cost[i][j]表示区间[i,j]内变成回文的最小代价

dp[i][j]表示前i个内有j个回文的代价

则递推式易得为dp[i][j]=dp[l][j-1]+cost[l+1][i];

 1 //#####################
 2 //Author:fraud
 3 //Blog: http://www.cnblogs.com/fraud/
 4 //#####################
 5 //#pragma comment(linker, "/STACK:102400000,102400000")
 6 #include <iostream>
 7 #include <sstream>
 8 #include <ios>
 9 #include <iomanip>
10 #include <functional>
11 #include <algorithm>
12 #include <vector>
13 #include <string>
14 #include <list>
15 #include <queue>
16 #include <deque>
17 #include <stack>
18 #include <set>
19 #include <map>
20 #include <cstdio>
21 #include <cstdlib>
22 #include <cmath>
23 #include <cstring>
24 #include <climits>
25 #include <cctype>
26 using namespace std;
27 #define XINF INT_MAX
28 #define INF 0x3FFFFFFF
29 #define MP(X,Y) make_pair(X,Y)
30 #define PB(X) push_back(X)
31 #define REP(X,N) for(int X=0;X<N;X++)
32 #define REP2(X,L,R) for(int X=L;X<=R;X++)
33 #define DEP(X,R,L) for(int X=R;X>=L;X--)
34 #define CLR(A,X) memset(A,X,sizeof(A))
35 #define IT iterator
36 typedef long long ll;
37 typedef pair<int,int> PII;
38 typedef vector<PII> VII;
39 typedef vector<int> VI;
40 int cost[510][510];
41 int dp[510][510];
42 int pre[510][510];
43 int gao[510];
44 int main()
45 {
46     ios::sync_with_stdio(false);
47     string str;
48     int k;
49     cin>>str;
50     cin>>k;
51     int len = str.length();
52     for(int i=0;i<len;i++){
53         for(int j=i;j<len;j++){
54             for(int l=i,r=j;l<r;l++,r--){
55                 if(str[l]!=str[r])cost[i][j]++;
56             }
57         }
58     }
59     for(int i=0;i<len;i++)dp[i][1]=cost[0][i];
60     for(int i = 1;i<len;i++){
61         for(int j = 2;j<=k;j++){
62             dp[i][j]=INF;
63             for(int l=0;l<i;l++){
64                 if(dp[i][j]>dp[l][j-1]+cost[l+1][i]){
65                     dp[i][j]=dp[l][j-1]+cost[l+1][i];
66                     pre[i][j]=l;
67                 }
68             }
69         }
70     }
71     int minn=INF;
72     int mink=0;
73     for(int i=1;i<=k;i++){
74         if(dp[len-1][i]<minn){
75             minn = dp[len-1][i];
76             mink = i;
77         }
78     }
79     gao[mink]=len-1;
80     for(int i=mink-1;i>0;i--){
81         gao[i] = pre[gao[i+1]][i+1];
82     }
83     gao[0]=-1;
84     cout<<minn<<endl;
85     for(int i =1;i<=mink;i++){
86         for(int l=gao[i-1]+1,r=gao[i];l<r;l++,r--){
87             if(str[l]!=str[r])str[l]=str[r];
88         }
89         for(int l=gao[i-1]+1,r=gao[i];l<=r;l++)cout<<str[l];
90         if(i<mink)cout<<"+";
91     }
92     cout<<endl;
93
94     return 0;
95 }

代码君

B - Last Chance

Description

Having read half of the book called "Storm and Calm" on the IT lesson, Innocentius was absolutely determined to finish the book on the maths lessons. All was fine until the math teacher Ms. Watkins saw Innocentius reading fiction books instead of solving equations of the fifth degree. As during the last maths class Innocentius suggested the algorithm of solving equations of the fifth degree in the general case, Ms. Watkins had no other choice but to give him a new task.

The teacher asked to write consecutively (without spaces) all words from the "Storm and Calm" in one long string s. She thought that a string is good if the number of vowels in the string is no more than twice more than the number of consonants. That is, the string with vvowels and c consonants is good if and only if v ≤ 2c.

The task Innocentius had to solve turned out to be rather simple: he should find the number of the longest good substrings of the string s.

Input

The only input line contains a non-empty string s consisting of no more than 2·105 uppercase and lowercase Latin letters. We shall regard letters "a", "e", "i", "o", "u" and their uppercase variants as vowels.

Output

Print on a single line two numbers without a space: the maximum length of a good substring and the number of good substrings with this length. If no good substring exists, print "No solution" without the quotes.

Two substrings are considered different if their positions of occurrence are different. So if some string occurs more than once, then it should be counted more than once.

Sample Input

Input

Abo

Output

3 1

Input

OEIS

Output

3 1

Input

auBAAbeelii

Output

9 3

Input

AaaBRAaaCAaaDAaaBRAaa

Output

18 4

Input

EA

Output

No solution

Hint

In the first sample there is only one longest good substring: "Abo" itself. The other good substrings are "b", "Ab", "bo", but these substrings have shorter length.

In the second sample there is only one longest good substring: "EIS". The other good substrings are: "S", "IS".

二分、线段树都可以,想清楚就行

 1 //#####################
 2 //Author:fraud
 3 //Blog: http://www.cnblogs.com/fraud/
 4 //#####################
 5 //#pragma comment(linker, "/STACK:102400000,102400000")
 6 #include <iostream>
 7 #include <sstream>
 8 #include <ios>
 9 #include <iomanip>
10 #include <functional>
11 #include <algorithm>
12 #include <vector>
13 #include <string>
14 #include <list>
15 #include <queue>
16 #include <deque>
17 #include <stack>
18 #include <set>
19 #include <map>
20 #include <cstdio>
21 #include <cstdlib>
22 #include <cmath>
23 #include <cstring>
24 #include <climits>
25 #include <cctype>
26 using namespace std;
27 #define XINF INT_MAX
28 #define INF 0x3FFFFFFF
29 #define MP(X,Y) make_pair(X,Y)
30 #define PB(X) push_back(X)
31 #define REP(X,N) for(int X=0;X<N;X++)
32 #define REP2(X,L,R) for(int X=L;X<=R;X++)
33 #define DEP(X,R,L) for(int X=R;X>=L;X--)
34 #define CLR(A,X) memset(A,X,sizeof(A))
35 #define IT iterator
36 typedef long long ll;
37 typedef pair<int,int> PII;
38 typedef vector<PII> VII;
39 typedef vector<int> VI;
40 bool check(char c){
41     if(c == ‘a‘ || c == ‘e‘ || c == ‘i‘ || c == ‘o‘ || c == ‘u‘)return 1;
42     return 0;
43 }
44 int a[200010];
45 int b[200010];
46 int main()
47 {
48     ios::sync_with_stdio(false);
49     string str;
50     cin>>str;
51     int len = str.length();
52     for(int i=0;i<len;i++){
53         if(str[i]>=‘A‘&&str[i]<=‘Z‘)str[i]=str[i]-‘A‘+‘a‘;
54     }
55     a[0]=0;
56     for(int i=0;i<len;i++){
57         a[i+1]=a[i];
58         if(check(str[i]))a[i+1]++;
59         else a[i+1]-=2;
60     }
61     b[len+1]=INF;
62     for(int i=len;i>=0;i--)b[i]=min(b[i+1],a[i]);
63     int ans = 0;
64     int sum = 0;
65     for(int i=0;i<len;i++){
66         int r=len+1,l=i;
67         while(l+1<r){
68             int mid = (l+r)>>1;
69             if(b[mid]<=a[i]){
70                 l=mid;
71             }else{
72                 r=mid;
73             }
74         }
75         if(ans<l-i){
76             ans=l-i;
77             sum=1;
78         }else if(ans==l-i){
79             sum++;
80         }
81     }
82     if(!ans)cout<<"No solution"<<endl;
83     else cout<<ans<<" "<<sum<<endl;
84
85
86
87     return 0;
88 }

代码君

C - Aggressive cows

Description

Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,...,xN (0 <= xi <= 1,000,000,000).

His C (2 <= C <= N) cows don‘t like this barn layout and become aggressive towards each other once put into a stall. To prevent the cows from hurting each other, FJ want to assign the cows to the stalls, such that the minimum distance between any two of them is as large as possible. What is the largest minimum distance?

Input

t – the number of test cases, then t test cases follows. 
* Line 1: Two space-separated integers: N and C
* Lines 2..N+1: Line i+1 contains an integer stall location, xi

Output

For each test case output one integer: the largest minimum distance.

Example

Input:

1
5 3
1
2
8
4
9

Output:

3

Output details:

FJ can put his 3 cows in the stalls at positions 1, 4 and 8, 
resulting in a minimum distance of 3.

直接二分答案,贪心判断。

 1 //#####################
 2 //Author:fraud
 3 //Blog: http://www.cnblogs.com/fraud/
 4 //#####################
 5 //#pragma comment(linker, "/STACK:102400000,102400000")
 6 #include <iostream>
 7 #include <sstream>
 8 #include <ios>
 9 #include <iomanip>
10 #include <functional>
11 #include <algorithm>
12 #include <vector>
13 #include <string>
14 #include <list>
15 #include <queue>
16 #include <deque>
17 #include <stack>
18 #include <set>
19 #include <map>
20 #include <cstdio>
21 #include <cstdlib>
22 #include <cmath>
23 #include <cstring>
24 #include <climits>
25 #include <cctype>
26 using namespace std;
27 #define XINF INT_MAX
28 #define INF 0x3FFFFFFF
29 #define MP(X,Y) make_pair(X,Y)
30 #define PB(X) push_back(X)
31 #define REP(X,N) for(int X=0;X<N;X++)
32 #define REP2(X,L,R) for(int X=L;X<=R;X++)
33 #define DEP(X,R,L) for(int X=R;X>=L;X--)
34 #define CLR(A,X) memset(A,X,sizeof(A))
35 #define IT iterator
36 typedef long long ll;
37 typedef pair<int,int> PII;
38 typedef vector<PII> VII;
39 typedef vector<int> VI;
40 const int maxn=100010;
41 int a[maxn];
42 int main()
43 {
44     ios::sync_with_stdio(false);
45     int n,c;
46     int t;
47     scanf("%d",&t);
48     while(t--)
49     {
50         scanf("%d%d",&n,&c);
51         for(int i=0;i<n;i++)
52         {
53             scanf("%d",&a[i]);
54         }
55         sort(a,a+n);
56         int l=0,r=1e9;
57         int ans=0;
58         while(l<=r)
59         {
60             int last=0;
61             int cnt=1;
62             int mid=(l+r)/2;
63             for(int i=0;i<n;i++)
64             {
65                 if(a[last]+mid<=a[i])
66                 {
67                     cnt++;
68                     last=i;
69                 }
70             }
71             if(cnt>=c)
72             {
73                 ans=max(ans,mid);
74                 l=mid+1;
75             }
76             else
77             {
78                 r=mid-1;
79             }
80         }
81         printf("%d\n",ans);
82     }
83
84
85     return 0;
86 }

代码君

D - Mixtures

Description

Harry Potter has n mixtures in front of him, arranged in a row. Each mixture has one of 100 different colors (colors have numbers from 0 to 99).

He wants to mix all these mixtures together. At each step, he is going to take two mixtures that stand next to each other and mix them together, and put the resulting mixture in their place.

When mixing two mixtures of colors a and b, the resulting mixture will have the color (a+b) mod 100.

Also, there will be some smoke in the process. The amount of smoke generated when mixing two mixtures of colors a and b is a*b.

Find out what is the minimum amount of smoke that Harry can get when mixing all the mixtures together.

Input

There will be a number of test cases in the input.

The first line of each test case will contain n, the number of mixtures, 1 <= n <= 100.

The second line will contain n integers between 0 and 99 - the initial colors of the mixtures.

Output

For each test case, output the minimum amount of smoke.

Example

Input:
2
18 19
3
40 60 20

Output:
342
2400

In the second test case, there are two possibilities:

  • first mix 40 and 60 (smoke: 2400), getting 0, then mix 0 and 20 (smoke: 0); total amount of smoke is 2400
  • first mix 60 and 20 (smoke: 1200), getting 80, then mix 40 and 80 (smoke: 3200); total amount of smoke is 4400

The first scenario is a much better way to proceed.

区间dp

 1 //#####################
 2 //Author:fraud
 3 //Blog: http://www.cnblogs.com/fraud/
 4 //#####################
 5 //#pragma comment(linker, "/STACK:102400000,102400000")
 6 #include <iostream>
 7 #include <sstream>
 8 #include <ios>
 9 #include <iomanip>
10 #include <functional>
11 #include <algorithm>
12 #include <vector>
13 #include <string>
14 #include <list>
15 #include <queue>
16 #include <deque>
17 #include <stack>
18 #include <set>
19 #include <map>
20 #include <cstdio>
21 #include <cstdlib>
22 #include <cmath>
23 #include <cstring>
24 #include <climits>
25 #include <cctype>
26 using namespace std;
27 #define XINF INT_MAX
28 #define INF 0x3FFFFFFF
29 #define MP(X,Y) make_pair(X,Y)
30 #define PB(X) push_back(X)
31 #define REP(X,N) for(int X=0;X<N;X++)
32 #define REP2(X,L,R) for(int X=L;X<=R;X++)
33 #define DEP(X,R,L) for(int X=R;X>=L;X--)
34 #define CLR(A,X) memset(A,X,sizeof(A))
35 #define IT iterator
36 typedef long long ll;
37 typedef pair<int,int> PII;
38 typedef vector<PII> VII;
39 typedef vector<int> VI;
40 int a[110];
41 int b[110][110];
42 int ans[110][110];
43 int main()
44 {
45     ios::sync_with_stdio(false);
46     int n;
47     while(cin>>n){
48         for(int i=0;i<n;i++)cin>>a[i];
49         for(int i=0;i<n;i++){
50             b[1][i]=a[i];
51             ans[1][i]=0;
52         }
53         for(int i=0;i<n-1;i++){
54             b[2][i]=(a[i]+a[i+1])%100;
55             ans[2][i]=a[i]*a[i+1];
56         }
57         for(int len=3;len<=n;len++){
58             for(int i=0;i<=n-len;i++){
59                 ans[len][i]=INF;
60                 for(int j=1;j<len;j++){
61                     int tmp = b[j][i]*b[len-j][i+j]+ans[j][i]+ans[len-j][i+j];
62                     if(tmp<ans[len][i]){
63                         ans[len][i]=tmp;
64                         b[len][i]=(b[j][i]+b[len-j][i+j])%100;
65                     }
66                 }
67             }
68         }
69         cout<<ans[n][0]<<endl;
70     }
71     return 0;
72 }

代码君

E - Postcards and photos

Description

Polycarpus has postcards and photos hung in a row on the wall. He decided to put them away to the closet and hang on the wall a famous painter‘s picture. Polycarpus does it like that: he goes from the left to the right and removes the objects consecutively. As Polycarpus doesn‘t want any mix-ups to happen, he will not carry in his hands objects of two different types. In other words, Polycarpus can‘t carry both postcards and photos simultaneously. Sometimes he goes to the closet and puts the objects there, thus leaving his hands free. Polycarpus must put all the postcards and photos to the closet. He cannot skip objects. What minimum number of times he should visit the closet if he cannot carry more than 5 items?

Input

The only line of the input data contains a non-empty string consisting of letters "С" and "P" whose length does not exceed 100characters. If the i-th character in the string is the letter "С", that means that the i-th object (the numbering goes from the left to the right) on Polycarpus‘ wall is a postcard. And if the i-th character is the letter "P", than the i-th object on the wall is a photo.

Output

Print the only number — the minimum number of times Polycarpus has to visit the closet.

Sample Input

Input

CPCPCPC

Output

7

Input

CCCCCCPPPPPP

Output

4

Input

CCCCCCPPCPPPPPPPPPP

Output

6

Input

CCCCCCCCCC

Output

2

Hint

In the first sample Polycarpus needs to take one item to the closet 7 times.

In the second sample Polycarpus can first take 3 postcards to the closet; then 3 more. He can take the 6 photos that are left in the similar way, going to the closet twice.

In the third sample Polycarpus can visit the closet twice, both times carrying 3 postcards. Then he can take there 2 photos at once, then one postcard and finally, he can carry the last 10 photos if he visits the closet twice.

In the fourth sample Polycarpus can visit the closet twice and take there all 10 postcards (5 items during each go).

直接从头往后搞

 1 //#####################
 2 //Author:fraud
 3 //Blog: http://www.cnblogs.com/fraud/
 4 //#####################
 5 //#pragma comment(linker, "/STACK:102400000,102400000")
 6 #include <iostream>
 7 #include <sstream>
 8 #include <ios>
 9 #include <iomanip>
10 #include <functional>
11 #include <algorithm>
12 #include <vector>
13 #include <string>
14 #include <list>
15 #include <queue>
16 #include <deque>
17 #include <stack>
18 #include <set>
19 #include <map>
20 #include <cstdio>
21 #include <cstdlib>
22 #include <cmath>
23 #include <cstring>
24 #include <climits>
25 #include <cctype>
26 using namespace std;
27 #define XINF INT_MAX
28 #define INF 0x3FFFFFFF
29 #define MP(X,Y) make_pair(X,Y)
30 #define PB(X) push_back(X)
31 #define REP(X,N) for(int X=0;X<N;X++)
32 #define REP2(X,L,R) for(int X=L;X<=R;X++)
33 #define DEP(X,R,L) for(int X=R;X>=L;X--)
34 #define CLR(A,X) memset(A,X,sizeof(A))
35 #define IT iterator
36 typedef long long ll;
37 typedef pair<int,int> PII;
38 typedef vector<PII> VII;
39 typedef vector<int> VI;
40
41 int main()
42 {
43     ios::sync_with_stdio(false);
44     string str;
45     cin>>str;
46     int len = str.length();
47     int ans = 0;
48     for(int i=0;i<len;i++){
49         int num = 0;
50         for(int j=i+1;j<i+5&&j<len;j++){
51             if(str[j]!=str[i])break;
52             num++;
53         }
54         i+=num;
55         ans++;
56     }
57     cout<<ans<<endl;
58     return 0;
59 }

代码君

F - Permutation

Description

"Hey, it‘s homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.

The sequence of n integers is called a permutation if it contains all integers from 1 to n exactly once.

You are given an arbitrary sequence a1, a2, ..., an containing n integers. Each integer is not less than 1 and not greater than 5000. Determine what minimum number of elements Polycarpus needs to change to get a permutation (he should not delete or add numbers). In a single change he can modify any single sequence element (i. e. replace it with another integer).

Input

The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).

Output

Print the only number — the minimum number of changes needed to get the permutation.

Sample Input

Input

33 1 2

Output

0

Input

22 2

Output

1

Input

55 3 3 3 1

Output

2

Hint

The first sample contains the permutation, which is why no replacements are required.

In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.

In the third sample we can replace the second element with number 4 and the fourth element with number 2.

大水

//#####################
//Author:fraud
//Blog: http://www.cnblogs.com/fraud/
//#####################
//#pragma comment(linker, "/STACK:102400000,102400000")
#include <iostream>
#include <sstream>
#include <ios>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cctype>
using namespace std;
#define XINF INT_MAX
#define INF 0x3FFFFFFF
#define MP(X,Y) make_pair(X,Y)
#define PB(X) push_back(X)
#define REP(X,N) for(int X=0;X<N;X++)
#define REP2(X,L,R) for(int X=L;X<=R;X++)
#define DEP(X,R,L) for(int X=R;X>=L;X--)
#define CLR(A,X) memset(A,X,sizeof(A))
#define IT iterator
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<PII> VII;
typedef vector<int> VI;
int num[100010];
int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int a;
    for(int i=0;i<n;i++){
        cin>>a;
        num[a]=1;
    }
    int ans =0;
    for(int i=1;i<=n;i++){
        if(!num[i])ans++;
    }
    cout<<ans<<endl;

    return 0;
}

时间: 2024-08-08 20:26:37

下沙友好群暑假训练二的相关文章

hdu 1267 下沙的沙子有几粒?(二维递推题)

题意:就是给你m个H和n个D,然后从左开始数H的累积个数总是不比D的累计数少的排列有多少种举一个测试案例吧:3个H和1个D总共有3种排列,依次是:H D H H,H H D H,H H  H D三种排列,亲~意思应该懂了吧?!呵呵... 思路:递推公式为:a[m][n]=a[m-1][n]+a[m][n-1];然后当n=0的时候无论m取何值都是1,递推公式怎么推来的呢?我现在说下我的思路吧!假设3个H和2个D是由2个H和2个D还有3个H一个D推来的,2个H和2个D总共有H D H D,H H D

hdu 1292 &quot;下沙野骆驼&quot;ACM夏令营

"下沙野骆驼"ACM夏令营 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 786    Accepted Submission(s): 377 Problem Description 大家都知道,杭电计算机学院为了吸引更多的学生参与到程序设计竞赛中去,从2005年秋天,开始举行月赛,并一直坚持到了现在.事实表明,这项措施的效

hdu 1292 &quot;下沙野骆驼&quot;ACM夏令营 (递推)

"下沙野骆驼"ACM夏令营 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 833    Accepted Submission(s): 403 Problem Description 大家都知道,杭电计算机学院为了吸引更多的学生参与到程序设计竞赛中去,从2005年秋天,开始举行月赛,并一直坚持到了现在.事实表明,这项措施的效

成济叫群容个二热三验火日这劳V0xian

聯感爭造利置海縣每整同總離半使器今上活真權候積太年萬族處幾點與空斷百九群法帶六光我來發節立技按農類點特你民基礦布任邊計存任部四實老專斗強通達使大千存離經就廣太已來領常王型現連形報工保象集放心半礦主身要米他強前文重省力你千論東入權機識著個程少記林持其沒習積在驗王物團完總石導知聯布效生法資眼度通七變適正口達識驗直傳術先織反題轉車下每系寫兒保加兒張照下設相區那定列度低相幾外今務級度安觀有包治加華發空識族連查業發米存給時人四單個走類裡總七手單平路少等條區權風取此影往人法十海八同變戰較條拉十然分府置單分火

ACM训练二C题

kmp对我真无奈,我对kmp真苦恼.就是个算法嘛,我以为凭我脖子上的东西可以搞定,现在好了--搞得我头都大了.要我写个啥next的值,五个字:那都不是事.一到啥实际应用吧,我意识不行了,搞不清next到底有什么作用,能干什么.就好比见到了二分啊-- 此题的意思呢,我弄了很久,其实是找相同串,比如ACMACMACMACMACMA,从后往前看next就行了,比如最后一个next[15] = 13,代表前13个字符串和后13位相同,直接用总长16 - 13 = 3,为一个解,接下来看next[13]了

Ubuntu下的用户和权限(二)

五.chown.chgrp命令 从名字就可以推测他们是干嘛的,但是这两个命令需要root权限. chown命令的格式为:chown user:group file  中间的user : group三项可以根据需要省略某部分.比如现在有个文件file属于用户bob,bob的权限是rwx,而bob属于组group1,group1的权限是r.有另外一个用户jack属于group2. chown jack file 这就把file的woner从bob改成了jack,但是file所属的群组仍然是group

Linux下Elasticsearch集群配置

一.简介 ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口.Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,是当前流行的企业级搜索引擎.设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便. 二.集群安装 1.选择指定的版本下载 wget https://download.elastic.co/elasticsearch/release/org/elas

Linux环境下HDFS集群环境搭建关键步骤

Linux环境下HDFS集群环境搭建关键步骤记录. 介质版本:hadoop-2.7.3.tar.gz 节点数量:3节点. 一.下载安装介质 官网下载地址:http://hadoop.apache.org/releases.html 二.服务器规划 MASTER:NAMENODE, DATANODENODE1:DATANODENODE2:SECONDARY NAMENODE, DATANODE 三.配置hostname和hosts 192.168.13.4 master192.168.13.5 n

Linux环境下SolrCloud集群环境搭建关键步骤

Linux环境下SolrCloud集群环境搭建关键步骤. 前提条件:已经完成ZooKeeper集群环境搭建. 一.下载介质 官网下载地址:http://www.apache.org/dyn/closer.lua/lucene/solr/7.3.1 历史版本下载:http://archive.apache.org/dist/lucene/solr/ 二.上传介质 通过工具将下载好的安装介质上传至服务器目录. 三.解压安装 解压即可完成安装. unzip solr-5.5.5.zip 四.修改配置文