Nyoj17 monotonically incrementing longest vertex sequence (DP)

Source: Internet
Author: User

Nyoj17 monotonically incrementing longest vertex sequence (DP)

 

  • Question 17
  • Question Information
  • Running result
  • Rankings
  • Discussion area monotonically incrementing maximum eldest son sequence time limit: 3000 MS | memory limit: 65535 KB difficulty: 4
    Description
    Returns the length of the longest incrementing sub-sequence of a string.
    For example, the longest incremental sub-sequence of dabdbf is abdf and the length is 4.
    Input
    The first line is an integer of 0. <20,表示有n个字符串要处理
    Next n rows, each line has a string, the length of the string will not exceed 10000 <20,表示有n个字符串要处理
    Output
    Length of the longest incrementing sub-sequence of the output string
    Sample Input
    3aaaababcabklmncdefg
    Sample output
    137
    Source
    Typical questions
    Uploaded
    Iphxer

     

    Very simple DP, from the back to the back .. Easy to understand

    Remember several classic DP, and all the problems in the future will come from these simple DP ..

     

     #include 
           
            #include 
            
             #include using namespace std;int main(){char a[10001];int t,len,i,j,dp[10001];scanf(%d,&t);getchar();while(t--){gets(a);len=strlen(a);for(i=0;i
             
              =0;i--){for(j=i+1;j
              
               

     

     

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.