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.
41 lines
1.0 KiB
41 lines
1.0 KiB
2 years ago
|
#include <bits/stdc++.h>
|
||
|
|
||
|
using namespace std;
|
||
|
int cnt, n;
|
||
|
|
||
|
int main() {
|
||
|
scanf("%d", &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;
|
||
|
}
|