Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
33046 | 王旭阳 | 打印数字图形 | C++ | Accepted | 4 MS | 744 KB | 467 | 2022-07-27 17:14:55 |
#include<iostream> using namespace std; int main() { int a; cin>>a; for(int i=a;i;i--) { for(int j=i-1;j;j--) { cout<<" "; } for(int j=1;j<=a-i+1;j++) { cout<<j; } for(int j=a-i;j;j--) { cout<<j; } cout<<endl; } for(int i=a-1;i>0;i--){ for(int j=1;j<=a-i;j++){ cout<<" "; } for(int j=1;j<=i;j++){ cout<<j; } for(int j=i-1;j>0;j--){ cout<<j; } cout<<endl; } return 0; }