Ruslan_Isaev

хуй знает будет работать или нет но я пытался

Mar 30th, 2021
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Горки_Богдана
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. { /* 4 3
  14. 5 3 2 5
  15. 5 2
  16. 1 2 3 5 3
  17. 3 0
  18. 1 1 1
  19. */
  20. int n;
  21. int countPalka;
  22. int countOperations = 0;
  23. int[] operation;
  24. using (var sr = new StreamReader("input.txt"))
  25. {
  26. n = int.Parse(sr.ReadLine());
  27. for (int i = 0; i < n; i++)// Партия хуёвин
  28. {
  29. countPalka = int.Parse(sr.ReadLine());
  30. int[] height = new int[countPalka];
  31. int max = 0;
  32. string[] str = sr.ReadLine().Split(' ');
  33. for (int j = 0; j < countPalka; j++)//Находим самый длинный хуй
  34. {
  35. height[j] = int.Parse(str[j]);
  36. if (height[j] > max)
  37. {
  38. max = height[j];
  39. }
  40. }
  41. for (int j = countPalka - 1; j > 0; j--)//Для каждой хуйни справа налево
  42. {
  43. /*while (height[j] <= max && height[j] < height[j - 1])//Пока хуй меньше максимума и
  44. {
  45. height[j]++;
  46. j = countPalka - 1;
  47. countOperations++;
  48. }
  49. j--;*/
  50. while (height[j] < max && height[j] < height[j - 1])
  51. {
  52. height[j]++;
  53. countOperations++;
  54. }
  55.  
  56. }
  57. operation = new int[n];
  58. operation[i] = countOperations;
  59. Console.WriteLine(operation[i]);
  60. countOperations = 0;
  61. }
  62. }
  63. Console.ReadKey();
  64. }
  65. }
  66. }
  67.  
Add Comment
Please, Sign In to add comment