Video2X:免费AI视频修复神器,让模糊视频秒变4K超高清
2026/7/10 17:10:29
#include <iostream> #include <iomanip> using namespace std; int main() { int n; cin >> n; int a[12][12] = {0}; // n≤12,数组开12足够 // 1. 填充对角线 j==i for (int i = 0; i < n; i++) { a[i][i] = i + 1; } // 2. 从倒数第二行往上计算每行右侧数字 for (int i = n - 2; i >= 0; i--) { // 对角线右边每一列 for (int j = i + 1; j < n; j++) { a[i][j] = a[i][j - 1] + a[i + 1][j]; } } // 3. 按格式打印,场宽5 for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (j < i) { cout << setw(5) << ""; // 左下空白 } else { cout << setw(5) << a[i][j]; } } cout << endl; } return 0; }