Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _08_Increasing_Elements
- {
- class Program
- {
- static void Main(string[] args)
- {
- // Колко пъти в поредицата числа ... едно от числата са по големи от предходното
- var n = int.Parse(Console.ReadLine());
- int counter = 0;
- var a1 = 0;
- // var a1 = int.Parse(Console.ReadLine());
- // Console.WriteLine("tova e a1 >>>>> {0}", a1);
- var a3 = 0;
- for (int i = 0; i < n - 1 ; i++)
- {
- if (i == 0)
- {
- a1 = n;
- //Console.WriteLine("tova e a1 >>>>> {0}", a1);
- }
- var a2 = int.Parse(Console.ReadLine());
- // Console.WriteLine("tova e a2 >>>>> {0}", a2);
- if ( a1 > a2 )
- {
- a3 = Math.Min(a1, a2);
- // Console.WriteLine("tova e a3 >>>>> {0}", a3);
- }
- if (a3 < a2)
- {
- a3 = Math.Max(a1, a2);
- // Console.WriteLine("tova e Max a3 >>>>> {0}", a3);
- }
- if (a3 > a1)
- {
- counter++;
- // Console.WriteLine("tova e counter >>>>> {0}", counter);
- }
- a1 = a3;
- // Console.WriteLine("tova e a1 >>>>> {0}", a1);
- }
- Console.WriteLine("{0}" , counter);
- // НЕ Е ВАЖНО ТУКА НАДОЛУ :)
- /*var n = int.Parse(Console.ReadLine());
- var num1 = int.Parse(Console.ReadLine());
- var counter = 0;
- for ( int i = 0; i < n - 1; i++)
- {
- var a1 = int.Parse(Console.ReadLine());
- if (num1 > a1)
- {
- num1 = a1;
- }
- else
- {
- counter = counter + 2;
- num1 = a1;
- }
- }
- Console.WriteLine(counter); // */
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement