'commit'
This commit is contained in:
43
TangDou/LuoGuBook/P5721.cpp
Normal file
43
TangDou/LuoGuBook/P5721.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user