static void Main() { n = int.Parse(Console.ReadLine()); stools = new Stool[n]; memo = new int[1 << n, n, 3]; for (int i = 0; i < n; i++) { var line = Console.ReadLine().Split(' '); stools[i] = new Stool( int.Parse(line[0]), int.Parse(line[1]), int.Parse(line[2]) ); } int result = 0; for (int i = 0; i < n; i++) { result = Math.Max(result, MaxHeight((1 << n) - 1, i, 0)); result = Math.Max(result, MaxHeight((1 << n) - 1, i, 1)); result = Math.Max(result, MaxHeight((1 << n) - 1, i, 2)); } Console.WriteLine(result); }
public static void Main(string[] args) { n = int.Parse(Console.ReadLine()); stools = new Stool[n]; memo = new int[1 << n, n, 3]; for (int i = 0; i < n; i++) { var line = Console.ReadLine().Split(' '); stools[i] = new Stool( int.Parse(line[0]), int.Parse(line[1]), int.Parse(line[2])); } int res = 0; for (int i = 0; i < n; i++) { res = Math.Max(res, MaxHeight((1 << n) - 1, i, 0)); res = Math.Max(res, MaxHeight((1 << n) - 1, i, 1)); res = Math.Max(res, MaxHeight((1 << n) - 1, i, 2)); } Console.WriteLine(res); }
static void Main(string[] args) { n = int.Parse(Console.ReadLine()); stools = new Stool[n]; memo = new int[1 << n, n, 3]; //memo = new int[1 << n, 16, 4]; for (int i = 0; i < n; i++) { var line = Console.ReadLine().Split(' '); stools[i] = new Stool( int.Parse(line[0]), int.Parse(line[1]), int.Parse(line[2]) ); } int result = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { result = Math.Max(result, MaxHeight((1 << n) - 1, i, j)); } } Console.WriteLine(result); }
static void Main(string[] args) { n = int.Parse(Console.ReadLine()); stools = new Stool[n]; memo = new int[1 << n, n, 3]; //memo = new int[1 << n, 16, 4]; // read input for (int i = 0; i < n; i++) { string[] line = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); stools[i] = new Stool( int.Parse(line[0]), int.Parse(line[1]), int.Parse(line[2]) ); } int result = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { result = Math.Max(result, MaxHeight((1 << n) - 1, i, j)); } } Console.WriteLine(result); }
public static void Main() { n = int.Parse(Console.ReadLine()); stools = new Stool[n]; calculatedValues = new int[1 << n, 15, 3]; for (int i = 0; i < n; i++) { int[] dimensions = Console .ReadLine() .Split(' ') .Select(x => int.Parse(x)) .ToArray(); stools[i] = new Stool(dimensions[0], dimensions[1], dimensions[2]); } int maxHeight = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { maxHeight = Math.Max(maxHeight, GetMaxHeight((1 << n) - 1, i, j)); } } Console.WriteLine(maxHeight); }
static void Main() { N = int.Parse(Console.ReadLine()); stools = new Stool[N]; memo = new int[1 << N, N, 3]; for (int i = 0; i < N; i++) { string[] line = Console.ReadLine().Split(' '); stools[i] = new Stool( int.Parse(line[0]), int.Parse(line[1]), int.Parse(line[2])); } int result = 0; for (int i = 0; i < N; i++) { result = Math.Max(result, Recourseint((1 << N) - 1, i, 0)); result = Math.Max(result, Recourseint((1 << N) - 1, i, 1)); result = Math.Max(result, Recourseint((1 << N) - 1, i, 2)); } Console.WriteLine(result); }
static void Main(string[] args) { n = int.Parse(Console.ReadLine()); stools = new Stool[n]; memo = new int[1 << n, n, 3]; //memo = new int[1 << n, 16, 4]; for (int i = 0; i < n; i++) { var line = Console.ReadLine().Split(' '); stools[i] = new Stool( int.Parse(line[0]), int.Parse(line[1]), int.Parse(line[2]) ); } for (int mask = 1; mask < (1 << n); mask++) { for (int i = 0; i < n; i++) { if (((mask >> i) & 1) == 1) { for (int j = 0; j < 3; j++) { MaxHeight(mask, i, j); } } } } int result = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { result = Math.Max(result, memo[(1 << n) - 1, i, j]); } } Console.WriteLine(result); }
static void Main() { n = int.Parse(Console.ReadLine()); stools = new Stool[n]; memos = new int[(1 << n), 16, 4]; for (int i = 0; i < n; i++) { var sides = Console.ReadLine().Split(' '); stools[i] = new Stool(int.Parse(sides[0]), int.Parse(sides[1]), int.Parse(sides[2])); } var max = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { max = Math.Max(max, GetMax((1 << n) - 1, i, j)); } } Console.WriteLine(max); }
public static void Main() { n = int.Parse(Console.ReadLine()); stools = new Stool[n]; memo = new int[1 << n, 16, 4]; for (int i = 0; i < n; i++) { int[] line = Console.ReadLine().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray(); stools[i] = new Stool(line[0], line[1], line[2]); } int result = 0; for (int i = 0; i < n; i++) { result = Math.Max(result, MaxHight((1 << n) - 1, i, 0)); result = Math.Max(result, MaxHight((1 << n) - 1, i, 1)); result = Math.Max(result, MaxHight((1 << n) - 1, i, 2)); } Console.WriteLine(result); }
static void Main() { n = int.Parse(Console.ReadLine()); stools = new Stool[n]; maxTowerMemo = new int?[n, 1 << n, 3]; for (int i = 0; i < n; i++) { var line = Console.ReadLine() .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); stools[i] = new Stool() { X = int.Parse(line[0]), Y = int.Parse(line[1]), Z = int.Parse(line[2]) }; } int result = 0; int used = (1 << n) - 1; for (int i = 0; i < n; i++) { if (stools[i].X == stools[i].Y && stools[i].Y == stools[i].Z) { result = Math.Max(result, MaxTower(i, used ^ (1 << i), SideHeight.X)); } else { result = Math.Max(result, MaxTower(i, used ^ (1 << i), SideHeight.X)); result = Math.Max(result, MaxTower(i, used ^ (1 << i), SideHeight.Y)); result = Math.Max(result, MaxTower(i, used ^ (1 << i), SideHeight.Z)); } } Console.WriteLine(result); }