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.
43 lines
1.1 KiB
43 lines
1.1 KiB
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
int cnt, n;
|
|
|
|
int main() {
|
|
cin >> n;
|
|
// 左上角
|
|
for (int i = 1; i <= n; i++) { //行
|
|
for (int j = 1; j <= n - i + 1; j++) //每行打印几个
|
|
printf("%02d", ++cnt);
|
|
printf("\n");
|
|
}
|
|
|
|
//左下角
|
|
printf("\n");
|
|
cnt = 0;
|
|
for (int i = 1; i <= n; i++) { //行
|
|
for (int j = 1; j <= i; j++) //每行打印几个
|
|
printf("%02d", ++cnt);
|
|
printf("\n");
|
|
}
|
|
//右下角
|
|
printf("\n");
|
|
cnt = 0;
|
|
for (int i = 1; i <= n; i++) { //行
|
|
for (int j = 1; j <= n - i; j++)
|
|
printf(" ");
|
|
for (int j = 1; j <= i; j++) //每行打印几个
|
|
printf("%02d", ++cnt);
|
|
printf("\n");
|
|
}
|
|
//右上角
|
|
printf("\n");
|
|
cnt = 0;
|
|
for (int i = 1; i <= n; i++) { //行
|
|
for (int j = 1; j <= i - 1; j++) printf(" ");
|
|
for (int j = 1; j <= n - i + 1; j++) //每行打印几个
|
|
printf("%02d", ++cnt);
|
|
printf("\n");
|
|
}
|
|
return 0;
|
|
} |