#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//从一个对角只能上下左右行进到另外一个对角矩阵有多少种走法
int main()
{
int arr[50][50] = { 0 };
arr[0][1] = 1;
printf(“please input the maxrow: “);
int maxrow = 0;
scanf(”%d”, &maxrow);
printf(“please input the maxcol: “);
int maxcol = 0;
scanf(”%d”, &maxcol);
for (int i = 1;i <= maxrow;i++)
{
for (int j = 1;j <= maxcol;j++)
{
arr[i][j] = arr[i][j -1]+arr[i-1][j];
}
}
printf("%d\n", arr[maxrow][maxcol]);
system(“pause”);
return 0;
}
方格矩阵路线问题
对角矩阵路径计数
最新推荐文章于 2020-07-13 16:12:53 发布
3036

被折叠的 条评论
为什么被折叠?



