̲Ͳ ² , IJ
. ..
603
3
.
.603.622.13.050103.126332.
. 622 ..
________________ ( ) (..)
(, )
:_______ ... ..
( , )
_____________________________
(, ) (..)
: ; .
1. .
2. .
3. .
4. ( ), .
1
X1 | X2 | X3 | X4 | X5 | X6 | X7 | |
X1 | |||||||
X2 | |||||||
X3 | |||||||
X4 | |||||||
X5 | |||||||
X6 | |||||||
X7 | |||||||
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LR3
{
class Program
{
//
static private int[][] initArray()
{
int[][] mat = new int[7][];
mat[0] = new int[7] { 0, 1, 1, 0, 0, 0, 0 };
mat[1] = new int[7] { 0, 0, 0, 1, 0, 0, 0 };
mat[2] = new int[7] { 0, 1, 0, 1, 0, 1, 0 };
mat[3] = new int[7] { 0, 0, 0, 0, 1, 1, 1 };
mat[4] = new int[7] { 0, 0, 0, 0, 0, 0, 1 };
mat[5] = new int[7] { 0, 0, 0, 0, 0, 0, 0 };
mat[6] = new int[7] { 0, 0, 0, 0, 0, 1, 0 };
return mat;
}
//
static private void outMatrix(int[][] x)
{
int i, j;
for (i = 0; i < x.Length; i++)
{
for (j = 0; j < x[i].Length; j++)
Console.Write(" " + x[i][j]);
Console.WriteLine();
}
Console.Write("\n");
}
//
static void outArray(int[] x)
{
for (int i = 0; i < x.Length; i++)
if (x[i] >= 0)
Console.Write(x[i] + "\t");
|
|
else Console.Write("-\t");
}
//
static int[] sumOfMatrix(int[][] a)
{
int[] x = new int[a[0].Length];
int i, j;
for (i = 0; i < a.Length; i++)
x[i] = 0;
for (i = 0; i < a.Length; i++)
for (j = 0; j < a[0].Length; j++)
x[i] += a[j][i];
return x;
}
static void Main(string[] args)
{
int[][] mat = initArray();
Console.WriteLine(" ( ):");
outMatrix(mat);
//Console.WriteLine(" :");
//outArray(layer);
int[] layer = sumOfMatrix(mat);
Console.Write("\n\n :\n");
int l = 0, n = 1;
List<string> res = new List<string>();
string r = "";
int i;
while (l < mat.Length)
{
r = "";
Console.Write(" " + n++ + ": ");
outArray(layer);
Console.WriteLine();
for (i = 0; i < layer.Length; i++)
{
if (layer[i] == 0)
{
r += (i + 1) + " ";
layer[i]--;
l++;
}
else
layer[i]--;
}
res.Add(r);
}
Console.WriteLine("\n: :");
for (i = 0; i < res.Count; i++)
Console.WriteLine(": " + (i + 1) + "\t\t : " + res[i]);
Console.Read();
}
}
}
.1. .
: , . , # Microsoft Visual Studio 2010.