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 _2laboratorinis
- {
- // |C(i, j) + min{ A(i-1, j-1), A(i-1, j) } | if (j = m) m = x
- //A =|C(i, j) + min{ A(i-1, j), A(i-1, j+1) } | if (j = 1) n = y
- // |C(i, j) + min{ A(i-1, j-1), A(i-1, j), A(i-1, j+1) } | if (j != 1) and (j != m) A - metodas
- class Program
- {
- const int x = 4;
- const int y = 6;
- static double[,] B = new double[x, y] { { 1, 2, 5, 10, 2, 5 }, { 3, 4, 8, 16, 4, 8, }, { 5, 6, 3, 40, 6, 3 }, { 7, 8, 6, 9, 8, 6 } };
- static void Main(string[] args)
- {
- /*for (int j = 0; j < x; j++)
- {
- B[0, j] = 0;
- }
- for (int j = 0; j < y; j++)
- {
- B[j, 0] = double.PositiveInfinity;
- B[j, x - 1] = double.PositiveInfinity;
- }*/
- for (int j = 0; j < x; j++)
- {
- for (int i = 0; i < y; i++)
- {
- Console.Write(B[j, i] + " ");
- }
- Console.WriteLine();
- }
- double sum = Recursive(1, 3);
- Console.ReadKey();
- }
- static double Recursive(int i, int j)
- {
- double sum = double.PositiveInfinity;
- Console.WriteLine(B[i,j]);
- return sum;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement