You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
548 B

2 years ago
#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;
}