Uva 1588 Kickdown

Source: Internet
Author: User

This problem thinking is not difficult to think, in the process of doing the main problems encountered are:

Because there is no careful consideration of the boundary situation, there is no comprehensive analysis, resulting in a large amount of time wasted due to the lack of access to the correct results.

In the future to do such topics, we must first carry out a more comprehensive analysis + simulation, and then write code, to avoid wasting time.

  

1#include <cstdio>2#include <cstring>3#include <algorithm>4 using namespacestd;5 #defineMAXN 10006 intMain () {7     intLen1,len2;8     CharS1[MAXN],S2[MAXN];9      while(SCANF ("%s%s", s1,s2)! =EOF) {Tenlen1=strlen (S1); OneLen2=strlen (S2); A          for(inti=len1;i<len1+len2;i++) s1[i]='0'; -          for(inti=len2;i<len1+len2;i++) s2[i]='0'; -         intOK; the         intminv=MAXN; -          for(intI=0; i<=len2;i++){ -ok=1; -              for(intj=0; J<min (len1,len2-i); J + +){ +                 if(s2[i+j]+s1[j]-2*'0'>3){ -ok=0; +                      Break; A                 } at             } -             if(Ok&&max (len2,len1+i) &LT;MINV) Minv=max (len2,len1+i); -         } -          for(intI=0; i<=len1;i++){ -ok=1; -              for(intj=0; J<min (len2,len1-i); J + +){ in                 if(s1[i+j]+s2[j]-2*'0'>3){ -ok=0; to                      Break; +                 } -             } the             if(Ok&&max (len1,len2+i) &LT;MINV) Minv=max (len1,len2+i); *         } $printf"%d\n", MINV);Panax Notoginseng     } -     return 0; the}

Uva 1588 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.