Files
python/TangDou/LuoGuBook/P5721_Study.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

24 lines
548 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
// n=5 i=1 j<=5
cin >> n; // 1~13
int k = 0;
for (int i = 1; i <= n; i++) { // 枚举每一行
//打印空格
for (int j = 1; j <= 2 * i - 2; j++)
printf(" ");
for (int j = 1; j <= n + 1 - i; j++) //枚举每一列
printf("%02d", ++k); //用0补全不足2位的数字加上前导0
// printf("\n");
// cout << endl;
puts("");
}
return 0;
}