Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Diagonal Difference
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here int n = Convert.ToInt32(Console.ReadLine()); int[][] a = new int[n][]; for(int a_i = 0; a_i < n; a_i++){ string[] a_temp = Console.ReadLine().Split(' '); a[a_i] = Array.ConvertAll(a_temp,Int32.Parse); } int primaryD = 0; int secD = 0; for(int i=0; i<n; i++){ int j= n-i-1; primaryD +=a[i][i]; secD +=a[i][j]; } int result = Math.Abs((primaryD - secD)); Console.WriteLine(result); } } }
run
|
edit
|
history
|
help
0
Output to get sum = 5 in given array of integers
binary search tree reversal
Plt-D v.0.9.2
2
recur 4
Plt-D v.0.8.1
dateTime parsing
asdasd
Метод catch b try в словарях
Hello world