UVA1588 UVALive3712 POJ3158 Kickdown

Source: Internet
Author: User

Regionals 2006 >> Europe-northeastern

Problem Link: UVA1588 UVALive3712 POJ3158 kickdown. Basic Training level problem, programming in C language.

Problem brief: (slightly).

The question to note is which of the two strings is possible on the left.

In the program, the cyclic control conditions need to be handled with care.

the C language Program of AC is as follows:

/* UVA1588 UVALive3712 POJ3158 kickdown */#include <stdio.h> #include <string.h> #define MIN (x, Y) (((x) > (y ))?    (y):(x)) #define MAXN 100char S[MAXN], t[maxn];int main (void) {int slen, Tlen, ans1, Ans2, I, J;        while (scanf ("%s", s)! = EOF) {scanf ("%s", T);        Slen = strlen (s);        Tlen = strlen (t);                /* s left, t right */for (i=0; i<slen; i++) {for (j=0; J<tlen && i+j<slen; j + +) {            if (s[i+j] = = ' 2 ' && t[j] = = ' 2 ') break;        } if (j = = Tlen | | i+j = = slen) break;        } ans1 = i + tlen;        if (Ans1 < Slen) ans1 = Slen;                /* t left, s right */for (j=0; j<tlen; J + +) {for (i=0; I<slen && j+i<tlen; i++) {            if (t[j+i] = = ' 2 ' && s[i] = = ' 2 ') break;        } if (i = = Slen | | j+i = = tlen) break; } Ans2 = j + Slen;        if (Ans2 < Tlen) Ans2 = Tlen;    printf ("%d\n", MIN (ans1, ans2)); } return 0;}

UVA1588 UVALive3712 POJ3158 Kickdown

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.