1018, hp1018

Source: Internet
Author: User

1018, hp1018

Longest Platform

Time Limit: 1000 MS Memory Limit: 65536 K
Total Submit: 225 Accepted: 92

Description

It is known that an array has been arranged from small to large, indicating a platform in this array.
(Plateau) is a continuous element with the same value, and this element cannot be extended.
Stretch. For example, in 2.2, 4,
5.5 and 6 are all platforms. Write a program to receive an array.
Find the platform. In the preceding example, 3.3.3 is the longest platform in the array. (Note:
Convenience. the maximum length of the array in the test case cannot exceed 50, and all elements in the array are integer
Enclosed in [-2 ^ 31,2 ^ 31-1]).

Input

Multiple groups of test data are processed to the end of the file. Each group of data is first composed of an array length of L, followed
It is composed of L data in the array.

Output

Maximum platform output for each test case

Sample Input

101 2 2 3 3 3 4 5 5 6111 1 1 1 1 1 2 2 2 2 251 2 3 4 5

Sample Output

361

Source

Ahstu @ ICPC02

    using System;    using System.Collections.Generic;    using System.Linq;    using System.Text;    namespace AK1018 {        class Program {            static void Main(string[] args) {                string sb;                while ((sb = Console.ReadLine()) != null) {                    int n = int.Parse(sb);                    int[] a = new int[10005];                    string[] s = Console.ReadLine().Split();                    for (int i = 0; i < n; i++)                        a[i] = int.Parse(s[i]);                    int count = 1;                    for (int i = 1; i < n; i++) {                        if (a[i] == a[i - count])                            count++;                    }                    Console.WriteLine(count);                }            }        }    }


Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger. Welcome to share your nice codes!

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.