为什么会错?QAQ 求帮助

B2083 画矩形

我远古时期写的代码: ```cpp #include<bits/stdc++.h> using namespace std; int main() { int a,b,f; char c; cin>>a>>b>>c>>f; if(f==1) { for(int i=0;i<a;i++) { for(int j=0;j<b;j++)cout<<c; cout<<endl; } return 0; } if(f==0) { for(int i=0;i<b;i++)cout<<c; cout<<endl; for(int i=0;i<a-2;i++) { cout<<c; for(int j=0;j<b-2;j++)cout<<' '; cout<<c<<endl; } for(int i=0;i<b;i++)cout<<c; return 0; } for(int i=0;i<a;i++) { for(int j=0;j<b;j++)cout<<c; cout<<endl; } return 0; } ```
by wjl_100930 @ 2023-08-14 15:49:24


@[chenxingran594777](/user/988515) 没有好好读题 ```cpp #include<bits/stdc++.h> using namespace std; int main() { int a,b,d; char c; cin>>a>>b>>c>>d; if(d!=0)//题目说0是实心,否则(注意)是空心 { for(int i=1;i<=a;i++) { for(int j=1;j<=b;j++) { cout<<c; } cout<<endl; } } else { for(int i=1;i<=a;i++) { for(int j=1;j<=b;j++) { if(i==1 || i==a || j==1 || j==b) { cout<<c; } else { cout<<" "; } } cout<<endl; } } return 0; } ```
by winsonW @ 2023-08-14 16:07:12


@[winsonW](/user/303739) 哦谢谢
by YSchencheche @ 2023-08-14 16:32:27


|