using System.Collections.Generic;
public static void Main()
int[] input = new int[]{0, 2, 7, 0};
List<int[]> input_memory = new List<int[]>();
int maxIndex = input.ToList().IndexOf(max);
double maxtolen = max/input.Length;
int max_to_lenght = int.Parse((Math.Floor(maxtolen)).ToString());
int max_rest = max%input.Length;
for(int i = 0; i < input.Length; i++)
input[i] = input[i] + (1 * max_to_lenght);
int dokonce = input.Length - maxIndex - 1;
int odzacatku = max_rest - dokonce;
for(int i = maxIndex + 1; i < input.Length; i++)
for(int i = 0; i <= odzacatku - 1; i++)
foreach(int item in input)
Console.Write(item + ",");
if (input_memory.Any(input.SequenceEqual))
Console.WriteLine("Počet iterací je: " + iteration);