ACM hoj 2087 flower cutting strip (simple question)

Source: Internet
Author: User
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 ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.