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.IO;
- using System.Threading.Tasks;
- namespace Горки_Богдана
- {
- class Program
- {
- static void Main(string[] args)
- { /* 4 3
- 5 3 2 5
- 5 2
- 1 2 3 5 3
- 3 0
- 1 1 1
- */
- int n;
- int countPalka;
- int countOperations = 0;
- int[] operation;
- using (var sr = new StreamReader("input.txt"))
- {
- n = int.Parse(sr.ReadLine());
- for (int i = 0; i < n; i++)// Партия хуёвин
- {
- countPalka = int.Parse(sr.ReadLine());
- int[] height = new int[countPalka];
- int max = 0;
- string[] str = sr.ReadLine().Split(' ');
- for (int j = 0; j < countPalka; j++)//Находим самый длинный хуй
- {
- height[j] = int.Parse(str[j]);
- if (height[j] > max)
- {
- max = height[j];
- }
- }
- for (int j = countPalka - 1; j > 0; j--)//Для каждой хуйни справа налево
- {
- /*while (height[j] <= max && height[j] < height[j - 1])//Пока хуй меньше максимума и
- {
- height[j]++;
- j = countPalka - 1;
- countOperations++;
- }
- j--;*/
- while (height[j] < max && height[j] < height[j - 1])
- {
- height[j]++;
- countOperations++;
- }
- }
- operation = new int[n];
- operation[i] = countOperations;
- Console.WriteLine(operation[i]);
- countOperations = 0;
- }
- }
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment