110,534
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml.Serialization;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
int[,] buff = { { 1, 3, 5 }, { 2, 4, 6 } };
int[,] newBuff = new int[2, 3];
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
newBuff[i, j] = buff[(i * 3 + j) % 2, (i * 3 + j) / 2];
}
}
}
}
}
using System;
namespace HelloWorldApplication
{
class HelloWorld
{
static void Main(string[] args)
{
int[,] arr = {{1,3,5},{2,4,6}};
int[,] newarr = new int[2,3];
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
newarr[i, j] = arr[(i*3+j)%2, (i*3+j)/2];
}
}
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
Console.Write(newarr[i, j].ToString() + " ");
}
Console.WriteLine();
}
}
}
}