博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
luoguP3959 [NOIP2017]宝藏(状压dp)
阅读量:4709 次
发布时间:2019-06-10

本文共 578 字,大约阅读时间需要 1 分钟。

www.cnblogs.com/shaokele/


luoguP3959:[NOIP2017]宝藏

  Time Limit: 1000 Sec

  Memory Limit: 256 MB
  p1
  p2
  p3
  p4
  p5
  

题目地址:  

题目大意:   

  选一个点作为根(起点),到达每一个节点

  
  \(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

转载于:https://www.cnblogs.com/shaokele/p/9163168.html

你可能感兴趣的文章
maven使用阿里镜像配置文件
查看>>
Copy code from eclipse to word, save syntax.
查看>>
arguments.callee的作用及替换方案
查看>>
Centos 6.5下的OPENJDK卸载和SUN的JDK安装、环境变量配置
查看>>
【.Net基础03】HttpWebRequest模拟浏览器登陆
查看>>
zTree async 动态参数处理
查看>>
Oracle学习之常见错误整理
查看>>
数据库插入数据乱码问题
查看>>
【转】IT名企面试:微软笔试题(1)
查看>>
IO流入门-第十章-DataInputStream_DataOutputStream
查看>>
DRF的分页
查看>>
Mysql 模糊匹配(字符串str中是否包含子字符串substr)
查看>>
python:open/文件操作
查看>>
流程控制 Day06
查看>>
Linux下安装Tomcat
查看>>
windows live writer 2012 0x80070643
查看>>
tomcat 和MySQL的安装
查看>>
git常用操作
查看>>
京东SSO单点登陆实现分析
查看>>
u-boot启动第一阶段
查看>>