为什么这个过不了啊
查看原帖
为什么这个过不了啊
576217
KAchor楼主2021/10/24 20:27

大佬们帮忙看看为什么是0分

#include<iostream>
#include<stdio.h>

using namespace std;

int main()
{
	int n;
	int YH[20][20];
	YH[0][0] = 1;
	YH[1][0] = 1;
	YH[1][1] = 1;
	cin >> n;
	cout << YH[0][0]<<endl;
	cout << YH[1][0] << "\t" << YH[1][1] << endl;
	for (int i=2;i<n;i++)
	{
		for (int j = 0; j <= i; j++)
		{
			if (j == 0 || j == i) YH[i][j] = 1;
			else YH[i][j] = YH[i - 1][j - 1] + YH[i - 1][j];
			cout << YH[i][j] << "\t";
		}
		cout << endl;
	}
}





2021/10/24 20:27
加载中...