Exemple #1
0
        public static void Solve()
        {
            int[] array;
            using (var inputFile = new StreamReader("inversions.in"))
            {
                int n = Int32.Parse(inputFile.ReadLine());
                array = new int[n];
                string[] inputArray = inputFile.ReadLine().Split();
                for (int i = 0; i < n; ++i)
                {
                    array[i] = Int32.Parse(inputArray[i]);
                }
            }
            InversionsCount <int> .cnt = 0;
            InversionsCount <int> .CountInversions(array);

            decimal result = InversionsCount <int> .cnt;

            using (var outputFile = new StreamWriter("inversions.out"))
            {
                outputFile.WriteLine(result);
            }
        }
Exemple #2
0
 public static void Solve()
 {
     InversionsCount <int> .Solve();
 }