Esempio n. 1
0
        //[SolutionMethod]
        public MRotateAnswer First(MRotateSample sample)
        {
            List <List <Int64> > arr = new List <List <Int64> >(sample.matrix);
            Int64 r     = sample.r;
            Int32 Rings = Math.Min(arr.Count, arr[0].Count) / 2;

            for (int j = 0; j < Rings; j++)
            {
                RotateRing2(arr, j, r);
            }
            PrintMatrix(arr);
            MRotateAnswer ans = new MRotateAnswer()
            {
                matrix = arr
            };

            return(ans);
        }
Esempio n. 2
0
        public TAnswer Second(TSample Sample)

        {
            MRotateSample sample = Sample as MRotateSample;

            List <List <Int64> > arr = new List <List <Int64> >(sample.matrix);
            Int32 r     = sample.r;
            Int32 Rings = Math.Min(arr.Count, arr[0].Count) / 2;

            for (int j = 0; j < Rings; j++)
            {
                RotateRing3(arr, j, r);
            }
            MRotateAnswer ans = new MRotateAnswer()
            {
                matrix = arr
            };

            return(ans);
        }
Esempio n. 3
0
        public override Boolean Equals(Object obj)
        {
            MRotateAnswer ans = obj as MRotateAnswer;

            if (ans?.matrix?.Count != matrix?.Count)
            {
                return(false);
            }
            for (int i = 0; i < matrix?.Count; i++)
            {
                if (matrix[i]?.Count != ans?.matrix[i]?.Count)
                {
                    return(false);
                }
                for (int j = 0; j < matrix[i].Count; j++)
                {
                    if (matrix[i][j] != ans.matrix[i][j])
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }