社区讨论
10pts,求调,玄关。
P2670[NOIP 2015 普及组] 扫雷游戏参与者 2已保存回复 8
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 8 条
- 当前快照
- 1 份
- 快照标识符
- @mid5ezpn
- 此快照首次捕获于
- 2025/11/24 20:54 3 个月前
- 此快照最后确认于
- 2025/11/24 21:11 3 个月前
![测试点]```cpp
#include <bits/stdc++.h>
using namespace std;
/天空属于哈夫克/
int main() {
long long n, m;
cin >> n >> m;
string a[n + 1][m + 1];
for (long long i = 1; i <= n; i++) {
for (long long j = 1; j <= m; j++) {
cin >> a[i][j];
}
}
string b[n][m];
for (long long i = 1; i <= n; i++) {
for (long long j = 1; j <= m; j++) {
if (a[i][j] == "") {
b[i - 1][j - 1] = '';
continue;
}
string cnt = 0;
if (a[i][j - 1] == "") {
long long t = stoi(cnt);
t++;
cnt = to_string(t);
} else if (a[i][j + 1] == "") {
long long t = stoi(cnt);
t++;
cnt = to_string(t);
} else if (a[i - 1][j] == "") {
long long t = stoi(cnt);
t++;
cnt = to_string(t);
} else if (a[i + 1][j] == "") {
long long t = stoi(cnt);
t++;
cnt = to_string(t);
} else if (a[i + 1][j + 1] == "") {
int t = stoi(cnt);
t++;
cnt = to_string(t);
} else if (a[i + 1][j - 1] == "") {
long long t = stoi(cnt);
t++;
cnt = to_string(t);
} else if (a[i - 1][j + 1] == "") {
long long t = stoi(cnt);
t++;
cnt = to_string(t);
} else if (a[i - 1][j - 1] == "") {
long long t = stoi(cnt);
t++;
cnt = to_string(t);
}
b[i - 1][j - 1] = cnt;
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cout << b[i][j];
}
}
CPPreturn 0;
}
CPP(file:///D:/HuaweiMoveData/Users/lsxx/Desktop/%E5%B1%80%E9%83%A8%E6%88%AA%E5%8F%96_20251124_202419.png)
回复
共 8 条回复,欢迎继续交流。
正在加载回复...