洛谷 P5732 【深基5.习7】杨辉三角
更多...
#include <luogu.h>
|
static int | main (istream &cin, ostream &cout) |
|
洛谷 P5732 【深基5.习7】杨辉三角
在文件 luogu.h 第 462 行定义.
◆ main()
int luogu::P5732::main |
( |
istream & | cin, |
|
|
ostream & | cout ) |
|
static |
在文件 luogu.cpp 第 1552 行定义.
1552 {
1555 auto *triangle =
new int *[
n];
1556 for(
int i = 0; i <
n; i++) {
1557 triangle[i] = new int[i + 1];
1558 for(int j = 0; j <= i; j++) {
1559 if(j == 0 || j == i) {
1560 triangle[i][j] = 1;
1561 } else {
1562 triangle[i][j] = triangle[i - 1][j - 1] + triangle[i - 1][j];
1563 }
1564 cout << triangle[i][j] << " ";
1565 }
1566 cout << endl;
1567 }
1568 for(
int i = 0; i <
n; i++) {
1569 delete[] triangle[i];
1570 }
1571 delete[] triangle;
1572 return 0;
1573 }
被这些函数引用 luogu::TEST().
该类的文档由以下文件生成: