Advertisement
Guest User

IncreasingElements

a guest
Apr 3rd, 2016
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 KB | None | 0 0
  1. namespace IncreasingElements2
  2. {
  3.     using System;
  4.     public class IncreasingElements2
  5.     {
  6.         public static void Main()
  7.         {
  8.             int n = int.Parse(Console.ReadLine());
  9.  
  10.             if (n <= 0)
  11.             {
  12.                 Console.WriteLine(0);
  13.                 return;
  14.             }
  15.  
  16.             int firstNum = int.Parse(Console.ReadLine());
  17.  
  18.             int maxCount = 0;
  19.             int currentCount = 1;
  20.             int count = 1;
  21.  
  22.             while (count < n)
  23.             {
  24.                 int currNum = int.Parse(Console.ReadLine());
  25.  
  26.                 if (currNum > firstNum)
  27.                 {
  28.                     currentCount++;
  29.                 }
  30.                 else
  31.                 {
  32.                     currentCount = 1;
  33.                 }
  34.  
  35.                 if (currentCount > maxCount)
  36.                 {
  37.                     maxCount = currentCount;
  38.                 }
  39.  
  40.                 firstNum = currNum;
  41.                 count++;
  42.             }
  43.  
  44.  
  45.             if (currentCount > maxCount)
  46.             {
  47.                 maxCount = currentCount;
  48.             }
  49.  
  50.             Console.WriteLine(maxCount);
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement