- 【例38.2】 图形输出
sb
- 2025-3-24 17:29:54 @
include<bits/stdc++.h> using namespace std; int main() { char c; int n; cin>>c>>n; if(c=='L'){ for(int i=1,sp=n-1,st=1;i<=n-1;i++,sp--,st+=2){ cout<<setw(sp)<<setfill(' ')<<' '; cout<<setw(st)<<setfill('')<<""; cout<<"\n"; } cout<<setw(2n-1)<<setfill('')<<""<<"\n"; for(int i=n-1,sp=1;i>=1;i--,sp++){ cout<<setw(sp)<<setfill(' ')<<' '; cout<<setw(2i-1)<<setfill('')<<""; cout<<"\n"; } } else{ for(int i=1;i<=n;i++){ cout<<setw(n)<<setfill('')<<""; cout<"\n"; } } return 0; }
0 comments
No comments so far...
Information
- ID
- 144
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 9
- Tags
- # Submissions
- 52
- Accepted
- 3
- Uploaded By