Advertisement
Guest User

Untitled

a guest
May 26th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _2laboratorinis
  8. {
  9. // |C(i, j) + min{ A(i-1, j-1), A(i-1, j) } | if (j = m) m = x
  10. //A =|C(i, j) + min{ A(i-1, j), A(i-1, j+1) } | if (j = 1) n = y
  11. // |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
  12. class Program
  13. {
  14.  
  15. const int x = 4;
  16. const int y = 6;
  17. 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 } };
  18.  
  19. static void Main(string[] args)
  20. {
  21. /*for (int j = 0; j < x; j++)
  22. {
  23. B[0, j] = 0;
  24. }
  25.  
  26. for (int j = 0; j < y; j++)
  27. {
  28. B[j, 0] = double.PositiveInfinity;
  29. B[j, x - 1] = double.PositiveInfinity;
  30. }*/
  31.  
  32. for (int j = 0; j < x; j++)
  33. {
  34. for (int i = 0; i < y; i++)
  35. {
  36. Console.Write(B[j, i] + " ");
  37. }
  38. Console.WriteLine();
  39. }
  40.  
  41. double sum = Recursive(1, 3);
  42. Console.ReadKey();
  43. }
  44.  
  45. static double Recursive(int i, int j)
  46. {
  47. double sum = double.PositiveInfinity;
  48. Console.WriteLine(B[i,j]);
  49.  
  50. return sum;
  51. }
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement