Flower scissors
Time Limit: 1000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 2819 accepted submission (s): 1884
Problem description
There are some patterns in a fabric, and some other small ornaments that can be used directly. For the given flower cloth and small ornaments, how many small ornaments can be cut out from the flower cloth as much as possible?
Input
The input contains some data, such as a pair of fabric and decoration. The fabric is represented by visible ASCII characters and the number of visible ASCII characters, how many patterns are there in the cloth pattern. The length of the pattern and ornament cannot exceed 1000 characters. If the # character is met, the job will not be started.
Output
The maximum number of small ornaments that can be cut out from the pattern cloth. If none of the ornaments exist, 0 will be output honestly, with a line break between each result.
Sample inputabcde A3
Aaaaaa
#
Sample output0
3. In the application of KMP, a substring is quickly matched in a parent string. The change made to this question is that in the matching process, when the condition is met, the match continues instead of exiting, check how many substrings can be produced in the parent string. Code As follows:
#include
# include
char ob [1005], sub [1005]; int next [1005], lob, LSUB; void exgetnext (char * t, int * Next) {int K = 1, j = 0; while (k