样例对了,但只有20分(c++)

B2083 画矩形

@[zhnagjiahan123](/user/983667) 你样例没过
by 天南星魔芋 @ 2023-08-28 12:09:57


@[zhnagjiahan123](/user/983667) 逆天,第10行后j==b改成j==1
by Algae_qwq @ 2023-08-28 12:30:26


谢谢
by Zjh_abcdbt_rnfmabj @ 2023-08-28 17:11:11


各路大神,改了还是错 ```cpp #include<bits/stdc++.h> using namespace std; int main() { int a,b,f; char c; cin>>a>>b>>c>>f; if(f==0){ for(int i=1;i<=a;i++){ for(int j=1;j<=b;j++){ if(i==1&&j==1||i==a&&j==1){//是这样改吗? for(int j=1;j<=b;j++){ cout<<c; if(j==b) cout<<endl; } } else { if(j==2){ cout<<c; for(int j=2;j<=b-1;j++) cout<<" "; cout<<c; cout<<endl; } } } } } else{ for(int i=1;i<=a;i++){ for(int j=1;j<=b;j++){ cout<<c; } cout<<endl; } } return 0; } ```
by Zjh_abcdbt_rnfmabj @ 2023-08-28 20:28:41


```cpp #include<bits/stdc++.h> using namespace std; int main() { int a,b,f; char c; cin>>a>>b>>c>>f; if(f==0){ for(int i=1;i<=a;i++){ for(int j=1;j<=b-1;j++){ if(i==1&&j==1||i==a&&j==1){ for(int j=1;j<=b;j++){ cout<<c; if(j==b) cout<<endl; } } else { if(j==1){ cout<<c; for(int j=2;j<=b-1;j++) cout<<" "; cout<<c; cout<<endl; } } } } } else{ for(int i=1;i<=a;i++){ for(int j=1;j<=b;j++){ cout<<c; } cout<<endl; } } return 0; } ``` 会了,谢谢
by Zjh_abcdbt_rnfmabj @ 2023-08-30 10:44:32


|