矩阵
0 0 0 0
0 1 1 1
0 1 2 2
0 1 2 3
如何实现呢
算法是怎样的?
运行不出我要的那个矩阵.....
请在给出一个算法吧
我研究了下哥们的代码,还是不会用数组表示出来
哥们还能再想想数组的表示算法吗?
编程 矩阵算法问题
答案:3 悬赏:70 手机版
解决时间 2021-04-03 22:34
- 提问者网友:绫月
- 2021-04-03 04:48
最佳答案
- 五星知识达人网友:十鸦
- 2019-09-09 22:47
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
{
if (m < i)
Console.Write("\t{0}",m++);
else
Console.Write("\t{0}",m);
}
Console.WriteLine();
}
}
}
}
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
if (m < i)
Console.Write("\t{0}",m++);
else
Console.Write("\t{0}",m);
}
Console.WriteLine();
}
}
}
}
全部回答
- 1楼网友:千杯敬自由
- 2020-09-08 08:47
算法部分:
int i,j=0,a[3][3]=0;
for(i=1;i<=3;i++)
{ a[i][j]=i-1;
for(j=i;j<=3;j++)
a[i][j]=i;
}
然后按四行四列输出就行!
我身边没有C没法运行,看有没有别的错误!我第一次上知道,没想到就遇上我喜欢的了
- 2楼网友:白昼之月
- 2020-06-09 21:47
y = [1:30]; %给出y
x = [0:2]'; %给出x
ytanspose = zeros(3, 10); %定义划分并转置后的存储矩阵
for i = 1 : 10
ytranspos(:, i) = (y(3*i-2, 3i))'; %将y按每3个一组进行划分,并进行转置
end
xcord = [1:10]; %用于画图的x坐标
ynorm = xcord; %用于画图的矩阵模
for i = 1 : 10
ynorm(i) = norm(ytranspos(:, i) - x); %求划分后的子向量与x的差的模
end
plot(xcord, ynorm);
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯
正方形一边上任一点到这个正方形两条对角线的 |
阴历怎么看 ? |