社区讨论
疑惑
B4360[GESP202506 四级] 画布裁剪参与者 3已保存回复 4
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 4 条
- 当前快照
- 1 份
- 快照标识符
- @miswv9qb
- 此快照首次捕获于
- 2025/12/05 21:39 2 个月前
- 此快照最后确认于
- 2025/12/07 16:05 2 个月前
为什么上面这个代码是CE,而下面这个能AC?看不出区别。
CPP#include<bits/stdc++.h>
using namespace std;
int h,w,x0,x2,y0,y2;
char a[101][101];
int main(){
cin>>h>>w>>x0>>x2>>y0>>y2;
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++){
cin>>a[i][j];
}
}
for(int i=1;i<=x2;i++){
for(int j=1;j<=y2;j++){
if(i>=x0&&j>=y0){
cout<<a[i][j];
}
}
if(i>=x0){
cout<<endl;
}
}
return 0;
}
CPP#include<bits/stdc++.h>
using namespace std;
int h,w,xa,xb,ya,yb;
char a[101][101];
int main(){
cin>>h>>w>>xa>>xb>>ya>>yb;
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++){
cin>>a[i][j];
}
}
for(int i=xa;i<=xb;i++){
for(int j=ya;j<=yb;j++){
cout<<a[i][j];
}
cout<<endl;
}
return 0;
}
哪位大佬那解释一下区别在哪里。解答者必关。
回复
共 4 条回复,欢迎继续交流。
正在加载回复...