Flower scissors
Time Limit: 1000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 2814 accepted submission (s): 1881
Problem description: a fabric with some patterns in it, and a small decoration that can be directly used. There are also some patterns in it. For the given flower cloth and small ornaments, how many small ornaments can be cut out from the flower cloth as much as possible?
The input contains some data, such as the fabric and Decoration in pairs. 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 outputs the maximum number of small ornaments that can be cut out from the pattern cloth. If none of them exist, 0 will be output honestly, with a line break between each result.
Sample inputabcde A3
Aaaaaa
#
Sample output0
3
Authorqianneng
Source is the second of winter training
Recommendlcy is a simple question. Pay attention to the input. Details: AC Program :
# Include <stdio. h ># include <iostream> using namespace STD; char a [1000]; char B [1000]; int main () {// freopen ("test. in "," r ", stdin); // freopen (" test. out "," W ", stdout); int I, j, Alen, blen, count; while (CIN> A & A [0]! = '#') {CIN> B; Count = 0; Alen = strlen (a); blen = strlen (B); for (I = 0; I <= Alen-blen; I ++) {int K = 0; if (a [I] = B [0]) {for (j = 1; j <blen; j ++) {if (a [I + J]! = B [J]) break;} If (j> = blen) {count ++; k = 1 ;}} if (k = 1) I + = blen-1; // pay attention to add blen-1, for loop that also add 1} cout <count <Endl;} return 0 ;}