为神马这个代码示例都过不了?
2023-12-20 21:33:50
发布于:浙江
11阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int m, n, k, l, d;
int main() {
cin >> m >> n >> k >> l >> d;
int s1[n + 1] = {0};
int s2[m + 1] = {0};
int x, y, i1, j1;
while (d--) {
cin >> x >> y >> i1 >> j1;
if (abs(x - i1) == 1) {
s1[min(x, i1)];//问题好像在这儿
}
if (abs(y - j1) == 1) {
s2[min(y, j1)];
}
}
while (k--) {
int maxx = 0, maxy, flag = 0;
for (int i = 1; i <= n - 1; i++) {
if (s1[i] > maxx) {
maxy = i;
flag = 1;
}
}
if (flag == 0) break;
else cout << maxy << " ";
}
cout<<endl;
while (l--) {
int maxx = 0, maxy, flag = 0;
for (int i = 1; i <= m - 1; i++) {
if (s2[i] > maxx) {
maxy = i;
flag = 1;
}
}
if (flag == 0) break;
else cout << maxy << " ";
}
return 0;
}//求大神指导,谢谢了!!!
这里空空如也
有帮助,赞一个