Advertisement
Guest User

Untitled

a guest
Aug 17th, 2016
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Sample
  4. {
  5.     class Program
  6.     {
  7.         public static void Main()
  8.         {
  9.             var n = int.Parse(Console.ReadLine());
  10.             var currentCount = 1;
  11.             var maxCount = n > 0 ? 1 : 0;
  12.             var previousNum = 0; ;
  13.             if (n > 0)
  14.             {
  15.                 previousNum = int.Parse(Console.ReadLine());
  16.             }
  17.             for (int i = 0; i < n - 1; i++)
  18.             {
  19.                 var currentNum = int.Parse(Console.ReadLine());
  20.                 if (currentNum > previousNum)
  21.                 {
  22.                     currentCount++;
  23.                     if (currentCount > maxCount)
  24.                     {
  25.                         maxCount = currentCount;
  26.                     }
  27.                 }
  28.                 else
  29.                 {
  30.                     currentCount = 1;
  31.                 }
  32.                 previousNum = currentNum;
  33.             }
  34.             Console.WriteLine(maxCount);
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement