求解这两题T_T
[Description] E.T. Inc. employs Maryanna as alien signal researcher. To identify possible
alien signals and background noise, she develops a method to evaluate the signals
she has already received. The signal sent by E.T is more likely regularly
alternative.
Received signals can be presented by a string of small latin letters 'a' to 'z'
whose length is N. For each X between 1 and N inclusive, she wants you to find out
the maximum length of the substring which can be written as a concatenation of X
same strings. For clarification, a substring is a consecutive part of the original
string.
[Input]
The first line contains T, the number of test cases (T <= 200). Most of the test
cases are relatively small. T lines follow, each contains a string of only small
latin letters 'a' - 'z', whose length N is less than 1000, without any leading or
trailing whitespaces.
[Output]
For each test case, output a single line, which should begin with the case number
counting from 1, followed by N integers. The X-th (1-based) of them should be the
maximum length of the substring which can be written as a concatenation of X same
strings. If that substring doesn't exist, output 0 instead. See the sample for more
format details.
Sample Input
2
arisetocrat
noonnoonnoon
Sample Output
Case #1: 11 0 0 0 0 0 0 0 0 0 0
Case #2: 12 8 12 0 0 0 0 0 0 0 0 0
[Hint]
For the second sample, the longest substring which can be written as a
concatenation of 2 same strings is "noonnoon", "oonnoonn", "onnoonno", "nnoonnoo",
any of those has length 8; the longest substring which can be written as a
concatenation of 3 same strings is the string itself. As a result, the second integer
in the answer is 8 and the third integer in the answer is 12.
(这题是区间DP,可是不会T_T)
[Description]
Jerry loses himself in the interesting game: Fruit Ninja. Fruit Ninja is a game
of iPhone and iPad in which the players cut the fruits coming from the bottom of
the screen and gain the bonus from cutting more than two fruits with a single slice.
Once a fruit is cut, it breaks into small pieces and cannot be cut any more.
After months of training, he becomes pro of this game. Actually, he can cut all
the fruits on the screen at any time. Jerry also has a bad habit that he has no willing
to leave some fruits for the future cutting. In the other words, after Jerry cuts
the fruits, all the fruits on the screen breaks and no one left. That is why all
his friends call him “Juice Extractor”.
Now he only consider about the bonus, when he cuts more than two fruits, he can
gain some bonus scores as same as the number of fruits he slice at that time. For
example, if Jerry cuts 4 fruits with a single slice, he can get 4 scores from this
slice.
After Jerry gets the fruit schedule, he knows the appearing time and the
disappearing time for every single fruit. He can only cut a fruit into pieces between
its appearing time and disappearing time inclusive. He wants to know the maximum
possible bonus scores he can receive.
[Input]
There are several test cases; the first line of the input contains a single
integer T, denoting the number of the test cases. (T <= 200)
For each test case, the first line contains an integer N, denoting the total
number of fruits. (1 <= N <= 1000)
The next N lines, each line describe a fruit. For each line, there are two
integers Xi and Yi, where Xi is the appearing time of the fruit and Yi is the
disappearing time of this fruit. (0 <= Xi <= Yi <= 1000000000)
[Output]
For each test case, output a single integer denoting the maximum scores that
Jerry could possibly gain. See the sample for further details.
Sample Input
1
10
1 10
2 11
3 12
4 13
13 14
Sample Output
Case #1: 10
求思想,求高手指导,求交流,求各种求 emil:clddn3581927@