Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
28625 | . | 打印数字图形 | C++ | Accepted | 2 MS | 752 KB | 543 | 2022-06-24 23:57:46 |
#include <bits/stdc++.h> #define left (k<<1) #define right (k<<1|1) using namespace std; const int maxn=3e4+10; int n; int main() { scanf("%d",&n); for(int l=1;l<=n;l++) { for(int i=n-l;i>=1;i--) printf(" "); for(int i=1;i<=l;i++) printf("%d",i); for(int i=l-1;i>=1;i--) printf("%d",i); printf("\n"); } for(int l=n-1;l>=1;l--) { for(int i=n-l;i>=1;i--) printf(" "); for(int i=1;i<=l;i++) printf("%d",i); for(int i=l-1;i>=1;i--) printf("%d",i); printf("\n"); } return 0; }