Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
100141 | Kevin | 打印菱形 | C++ | Accepted | 2 MS | 276 KB | 419 | 2024-12-04 15:12:56 |
#include<bits/stdc++.h> using namespace std; int main(){ int n,m,z=1; cin>>n; m=n-1; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cout<<" "; } for(int j=1;j<=z;j++){ cout<<"*"; } z+=2; m--; cout<<endl; } z-=2; for(int i=1;i<n;i++){ for(int j=1;j<=i;j++){ cout<<" "; } for(int j=1;j<z-1;j++){ cout<<"*"; } z-=2; cout<<endl; } return 0; }