D. Equivalent Strings

Source: Internet
Author: User

D. Equivalent Strings

1#include <iostream>2#include <cstdio>3#include <cstring>4#include <cmath>5#include <algorithm>6#include <string>7#include <vector>8#include <Set>9#include <map>Ten#include <queue> One#include <sstream> A using namespacestd; - typedef __int64 LL; - Const intINF =0x4ffffff; the Const DoubleEXP = 1e-5; - ConstLL mod = 1e9+7; - Const intms=200005; -  +  - BOOLequalsstringS1,stringS2) + { A       intLen1 =s1.size (); at       intLen2 =s2.size (); -       if(S1 = =S2) -             return true; -      Else if(len1! = Len2 | | (len1&1) ==1|| (Len2 &1) ==1) -            return false; -       Else in       { -        //if (Equals (S1.substr (0,LEN1/2), S2.substr (0,LEN1/2)) && equals (S1.substr (LEN1/2,LEN1/2), S2.substr (len1 /2,LEN1/2 ))) to         //return true; //do not put this back will time out, because the front S1 = = S2 did not pass. Indicates that there are different characters in the same position. Cross comparison can be optimized first.  +  -              if(Equals (S1.substr (0, len1/2), S2.substr (len1/2, len1/2)) && equals (S1.substr (len1/2, len1/2), S2.substr (0, len1/2))) the                   return true; *             if(Equals (S1.substr (0, len1/2), S2.substr (0, len1/2)) && equals (S1.substr (len1/2, len1/2), S2.substr (len1/2, len1/2))) $                  return true;Panax Notoginseng  -              return false; the       } + } A  the  + intMain () - { $       strings1,s2; $Cin>>s1>>S2; -       if(Equals (S1,S2)) -printf"yes\n"); the       Else -printf"no\n");Wuyi       return 0; the}

D. Equivalent Strings

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.