1283 ancient wooden jump

Source: Internet
Author: User
Description

Velv was very happy these days because she finally solved the skiing problem !!!

Of course, she is not complacent. This time, she encountered another question about sports: Jump wooden stakes. The wooden jump is an ancient movement. Ancient tribes hold this kind of movement during Sacrifices and pray for peace. They arranged some tall wooden piles neatly in a straight line. Athletes must jump from left to right and only fall onto tall or tall wooden stakes (velv notices this is the opposite of skiing ).

Note: The wooden piles are placed very close, and the athletes selected from the tribe bounce very well. They can easily skip any Wooden Pile and safely fall onto the required wooden pile.

Finally, the referee judges who have trampled the most wooden piles to win.

Input

Multiple Input groups. The first positive integer t represents the number of groups.

The first row of each group has a positive integer N, 1 ≤ n ≤ 1000, indicating the number of wooden piles.

The second act is H1, H2 ,..., Hn contains N non-negative values (in the int32 range), indicating the height of the Wooden Pile arranged from left to right.

Output

The first line of each group outputs the maximum number of piles that can be trampled

Sample Input
231 2 352 5 3 6
Sample output
34

this question is to use greed to sort the height, from low to high

 # include 
   
     using namespace STD; int H [1000]; int num [1000]; int main () {int t, n, I, j; CIN> T; while (t --) {CIN> N; for (I = 0; I 
    
      H [I]; num [I] = 1 ;}for (I = 1; I 
     
       J) J = num [I]; cout 
      

       

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.