www.cnblogs.com/shaokele/
luoguP3959:[NOIP2017]宝藏
Time Limit: 1000 Sec
Memory Limit: 256 MB
题目地址:
题目大意:
选一个点作为根(起点),到达每一个节点
从 \(u\) 到 \(v\) 的代价为根到 \(v\) 的距离 \(dis\) 乘以 \(u,v\) 间距离 \(w\) ,求最小总代价
题解:
考试时没A 哭唧唧
其实就是一个状态压缩啦 具体看代码
AC代码
#include#include #include using namespace std;const int N=15,M=5000,inf=10000000; int n,m;int log[M],dis[N],p[N],g[M],f[M],mat[N][N],dp[N][M];int main(){ scanf("%d%d",&n,&m); for(int i=0;i