Advertisement
DaVinchester

Untitled

Mar 20th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. using System;
  2.  
  3. public class MainClass
  4. {
  5.     public static void Main()
  6.     {
  7.         int n = Convert.ToInt32(Console.ReadLine());
  8.         string[] sinput = Console.ReadLine().Split();
  9.         int[] s = new int[n];
  10.         for (int i = 0; i < n; i++)
  11.         {
  12.             s[i] = Convert.ToInt32(sinput[i]);
  13.         }
  14.         int count = 0;
  15.         for (int i = 0; i < n - 1; i++)
  16.         {
  17.            if (s[i] < s[i + 1])
  18.            {
  19.                count++;
  20.            }
  21.         }
  22.         if (count > 0)
  23.         {
  24.             Console.Write(count + 1);
  25.         }
  26.         else
  27.         {
  28.             if (n == 1)
  29.             {
  30.                  Console.Write("1");
  31.             }
  32.             else
  33.             {
  34.                 Console.Write("0");
  35.             }
  36.         }        
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement