Advertisement
AvengersAssemble

P65Ex13

Jan 2nd, 2014
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1.         public static void AppearOnce(int[,] m)
  2.         {
  3.             int[] arr = new int[m.Length];
  4.             int count = 0, countApp = 0, k = 0, j = 0, row = 0, col = 0;
  5.             while (j < m.GetLength(1))
  6.             {
  7.                 countApp = row = col = 0;
  8.                 while (col < m.GetLength(1))
  9.                 {
  10.                     if (m[row, col] == m[j, k] && !(row == j && col == k))
  11.                         countApp++;
  12.                     row++;
  13.                     if (row == m.GetLength(0))
  14.                     {
  15.                         row = 0;
  16.                         col++;
  17.                     }
  18.                 }
  19.                 if (countApp == 0)
  20.                 {
  21.                     arr[count] = m[j, k];
  22.                     count++;
  23.                 }
  24.                 k++;
  25.                 if (k == m.GetLength(0))
  26.                 {
  27.                     k = 0;
  28.                     j++;
  29.                 }
  30.             }
  31.             for (int i = 0; i < count; i++)
  32.                 Console.Write(arr[i]);
  33.             Console.WriteLine();
  34.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement