fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. int[][] Arr =
  8. {
  9. new int[]{2, 5, 11 },
  10. new int[]{2, 5, 9 },
  11. new int[]{ 5, 2, 1}
  12. };
  13. //
  14. Print(Arr);
  15. //
  16. int Sum;
  17. for (int i1 = 0; i1 < Arr.Length; i1++)
  18. {
  19. Sum = -2 * Arr[i1][i1];
  20. for (int i2 = 0; i2 < Arr.Length; i2++)
  21. Sum += Arr[i2][i1] + Arr[i1][i2];
  22. Arr[i1][i1] = Sum;
  23. }
  24. //
  25. Print(Arr);
  26. }
  27.  
  28. public static void Print<T>(T[][] Arr)
  29. {
  30. foreach(T[] _Arr in Arr)
  31. {
  32. foreach (T i in _Arr) Console.Write(i + " ");
  33. Console.WriteLine();
  34. }
  35. }
  36. }
Success #stdin #stdout 0.02s 15952KB
stdin
Standard input is empty
stdout
2  5  11  
2  5  9  
5  2  1  
23  5  11  
2  18  9  
5  2  27