POJ1936-All in all

Source: Internet
Author: User

 

Reprinted please indicate the source: Thank you

Http://user.qzone.qq.com/289065406/blog/1300626728

 

Find the child string of S1 in S2. I still wanted to use LCS. Later I thought about it. This would consume too much space, and it would be troublesome to use a rolling array... After all, the maximum number of columns is 10 W = so I still forget it, directly simulate faster =

Conclusion: let alone the water question. \ (^ o ^ )/~

Note that the subscript range of Int Is less than. I use long

 

 

// Memory time // 364 K 0 Ms # include <iostream> # include <string> using namespace STD; int main (long I, long J) {char S1 [100000], s2 [100000]; while (CIN> S1> S2) {long len1 = strlen (S1); long len2 = strlen (S2); I = 0; j = 0; while (true) {if (I = len1) {cout <"yes" <Endl; break;} else if (I <len1 & J = len2) {cout <"no" <Endl; break;} If (S1 [I] = S2 [J]) {I ++; j ++ ;} elsej ++;} memset (S1, '\ 0', sizeof (S1); memset (S2,' \ 0', sizeof (S2);} 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.