111,120
社区成员
发帖
与我相关
我的任务
分享int[,] ss = new int[,] { { 1, 1, 1, 1, 1, 1 }, { 2, 2, 2, 3, 3, 4 }, { 3, 4, 5, 4, 5, 5 } };
int[] n = new int[] { 1, 2, 3, 4, 5 };
string str = "";
for (int j = 0; j < 3; j++)
{
for (int i = 0; i < 6; i++)
{
for (int k = 0; k < 5; k++)
{
str += string.Format("{0} ", n[(ss[j, i] + k - 1) % 5]);
}
//str += "\r\n";
}
str += "\r\n";
}
MessageBox.Show(str); int[,] ss = new int[,] { { 1, 1, 1, 1, 1, 1 }, { 2, 2, 2, 3, 3, 4 }, { 3, 4, 5, 4, 5, 5 } };
int[] n = new int[] { 1, 2, 3, 4, 5 };
string str="";
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < 3; j++)
{
for (int k = 0; k < 5; k++)
{
str += string.Format("{0} ", n[(ss[j, i] + k - 1) % 5]);
}
str +="\r\n";
}
str+="\r\n";
}
MessageBox.Show(str);
class PrintArray {
public static List<int[]> InitArray(int maxNumber, int minNumber) {
List<int[]> array = new List<int[]>();
int[] aaa = new int[3] { 1, 1, 1};
while (aaa[0] < 2) {
bool flag = false;
for (int i = 0; i < aaa.Length - 1; i++) {
if (aaa[i] >= aaa[i + 1]) {
flag = true;
break;
}
}
if (!flag) {
int[] temp = new int[aaa.Length];
for (int i = 0; i < aaa.Length; i++) {
temp[i] = aaa[i];
}
array.Add(temp);
foreach (int item in aaa) {
Console.Write("{0} ", item);
}
Console.Write("\n");
}
aaa[aaa.Length - 1]++;
for (int i = aaa.Length - 1; i > 0; i--) {
if (aaa[i] > maxNumber) {
aaa[i - 1]++;
aaa[i] = minNumber;
}
}
}
Console.Write("\n\n");
return array;
}
public static void Print(List<int[]> srcArray, int maxNumber, int minNumber) {
List<int[]> before = new List<int[]>();
Console.WriteLine("未翻转:");
foreach (int[] item in srcArray) {
foreach (int number in item) {
Console.Write("{0} ", number);
}
before.Add(item);
Console.Write("\n");
int ii = minNumber;
while (ii < maxNumber) {
int[] temp = new int[item.Length];
for (int i = 0; i < item.Length; i++) {
temp[i] = item[i];
}
for (int i = 0; i < temp.Length; i++) {
temp[i] += ii;
if (temp[i]> maxNumber) {
temp[i] %= maxNumber;
}
Console.Write("{0} ", temp[i]);
}
before.Add(temp);
Console.Write("\n");
ii++;
}
}
Console.Write("\n翻转:\n");
int[][] abc = before.ToArray();
int[,] cba = new int[abc[0].Length, abc.Length];
for (int i = 0; i < abc.Length; i++) {
for (int j = 0; j < abc[i].Length; j++) {
cba[j, i] = abc[i][j];
}
}
for (int i = 0; i < abc[0].Length; i++) {
for (int j = 0; j < abc.Length; j++) {
Console.Write("{0} ", cba[i, j]);
}
Console.Write("\n");
}
}
}