题目链接:uva 11561 - Getting Gold
题目大意:就是一张图,每次走到陷阱周围,为了防止调入陷阱,会停止前进,问说最多能收集多少黄金。
解题思路:bfs,将陷阱周围标记,走到就停止即可。
#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std;
const int maxn = 55;
const int dir[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
typedef pair<int, int> pii;
int W, H, v[maxn][maxn];
char g[maxn][maxn];
void tiger (int x, int y) {
......
阅读全文