- 【例37.3】 菱形图形
h
- 2025-1-14 14:59:48 @
#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
cin>>n;
for(int i=1;i<=n;i++){
for(int k=0;k<n-i;k++) cout<<" ";
for(int j=1;j<=2*i-1;j++){
cout<<j;
}
cout<<"\n";
}
for(int i=n-1;i>=1;i--){
for(int k=0;k<n-i;k++) cout<<" ";
for(int j=1;j<=2*i-1;j++){
cout<<j;
}
cout<<"\n";
}
return 0;
}
0 comments
No comments so far...
Information
- ID
- 139
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- # Submissions
- 97
- Accepted
- 19
- Uploaded By