前言
暴力+最短路 debug半天 传送门 :
思路样例就30我们可以枚举所有方案
同时我们只需要记录每一次最小挪动石头的方案就行
我们可以设置石头 为1 没有为0
然后跑最短路
CODE#include
using namespace std;
#define ll long long
#define endl '\n'
#define px first
#define py second
typedef pair pii;
int dxy[4][2] = {{-1,0},{0,1},{1,0},{0,-1}};
const int N = 40;
int n,m,t;
int mp[N][N],f[N][N];
int ans ;
struct node
{
int x, y;
};
int cal_distance(int x1,int y1 ,int x2 ,int y2)
{
return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
void cal(int x1,int y1)
{
for(int i=1;i
关注
打赏