编程 矩阵算法问题

来源:百度知道 编辑:UC知道 时间:2024/06/17 22:47:09
矩阵
0 0 0 0
0 1 1 1
0 1 2 2
0 1 2 3
如何实现呢
算法是怎样的?
运行不出我要的那个矩阵.....

请在给出一个算法吧

我研究了下哥们的代码,还是不会用数组表示出来

哥们还能再想想数组的表示算法吗?

int[] a={0 ,0, 0, 0,
0, 1, 1, 1,
0, 1, 2, 2,
0 ,1 ,2 ,3 }

//明显是有规律的嘛
//任何大小的矩阵,前提是你屏幕够大
using System;
using System.Collections.Generic;
using System.Text;

namespace baidu
{
class Program
{
static void Main(string[] args)
{
const int num = 9;
for (int i = 0; i < num; i++)
{
int m = 0;
for (int j = 0; j <num;j++ )
{

if (m < i)
Console.Write("\t{0}",m++);
else
Console.Write("\t{0}",m);

}
Console.WriteLine();
}
}
}
}

算法部分:
int i,j=0,a[3][3]=0;
for(i=1;i<=3;i++)
{