摘要:
http://poj.org/problem?id=3278就是农场主在X轴上找牛,给定牛的坐标,扭不动,农场主可以 +1 -1 *2 的方式前进,求最少的步数使其找到牛。分三种情况走,直到遇到牛即可,同时为了避免不断的重复于某一点,记录到达该点的最短距离。View Code #include <iostream>#include <cstring>#include <cstdio>#include <queue>#define maxn 100007#define inf 9999999using namespace std;int ans,s 阅读全文