Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
152722 鲁博睿 打印杨辉三角 C++ Accepted 2 MS 268 KB 487 2026-05-01 20:43:26

Tests(15/15):


Code:

#include <iostream> using namespace std; long long a[35]; int main() { int n; cin >> n; a[1] = 1; cout << "1" << endl; for (int i = 2; i <= n; i++) { for (int j = i; j >= 2; j--) { a[j] = a[j-1] + a[j]; } a[1] = 1; for (int j = 1; j <= i; j++) { cout << a[j]; if (j < i) { cout << " "; } } cout << endl; } return 0; }