Sicily 1035. DNA Matching

Source: Internet
Author: User

1#include <iostream>2#include <cstdio>3#include <string>4#include <algorithm>5 using namespacestd;6 7 BOOLcmpstringAstringb);8 BOOLMatchstringAstringb);9 Ten  One intMainvoid) { A     inttestsize, couple; -     stringstr[101]; -     intlen[101]; the     BOOLused[101]; -  -     //For each test case: (t<=20) -CIN >>testsize; +      while(testsize--) { -         //Scan and Store n strings (n <=) +CIN >>couple; A          for(inti =0; i < couple; ++i) { atCIN >>Str[i]; -         } -  -         //Sort by length -Sort (str, str +couple, CMP); -         //sort (< #_RandomAccessIterator __first#>, < #_RandomAccessIterator __last#>, < #_Compare __comp# >) in  -          for(inti =0; i < couple; ++i) { to             //Store Length +Len[i] =str[i].size (); -             //Init used theUsed[i] =false; *         } $ Panax Notoginseng         intCount =0; -  the          for(inti =0; i < couple; ++i) { +             if(!Used[i]) { A                  for(intj = i +1; J < couple && Len[j] = = Len[i]; ++j) { the                     if(Match (Str[i], str[j]) &&!Used[j]) { +count++; -Used[i] = used[j] =true; $                          Break; $                     } -                 } -             } the         } - Wuyicout << Count <<'\ n'; the     } -  Wu     return 0; - } About  $ BOOLcmpstringAstringb) - { -     returnA.size () >b.size (); - } A BOOLMatchstringAstringb) { +     intLen =a.size (); the      for(inti =0; i<len; i++) { -         if(A[i] = ='A'&& B[i]! ='T') $             return false; the         if(A[i] = ='T'&& B[i]! ='A') the             return false; the         if(A[i] = ='C'&& B[i]! ='G') the             return false; -         if(A[i] = ='G'&& B[i]! ='C') in             return false; the     } the     return true; About}

Sicily 1035. DNA Matching

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.