SHARE
TWEET

IncreasingElementsSequence

koksibg Oct 31st, 2016 (edited) 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace IncreasingElementsSequence
  8. {
  9.     class Program
  10.     {
  11.         static void Main()
  12.         {
  13.             var n = int.Parse(Console.ReadLine());
  14.             var counter1 = 0;
  15.             var counter2 = 0;
  16.             var number1 = 0;
  17.             for (int i = 0; i < n; i++)
  18.             {
  19.                 var number2 = int.Parse(Console.ReadLine());
  20.                 if (number2 > number1)
  21.                 {
  22.                   counter1++;
  23.                 }
  24.                 else
  25.                 {
  26.                   counter1 = 1;
  27.                 }
  28.                 if (counter1 > counter2)
  29.                 {
  30.                   counter2 = counter1;
  31.                 }
  32.             number1 = number2;
  33.             }
  34.             Console.WriteLine(counter2);
  35.         }
  36.     }
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top