P1273 有线电视网 

很明显,这是一道树形DP(图都画出来了,还不明显吗?)

未做完,持续更新中……

#include<cstdio>
#include<cstring>
using namespace std;
const int maxn=;
int n,m;
struct edge{
int from,to,money;
int next;
}e[maxn*];
int read()
{
int x=,f=;char c=getchar();
while(!isdigit(c)){if(c=='-')f=-;c=getchar();}
while(isdigit(c)){x=x*+c-'';c=getchar();}
return x*f;
}
int cnt=,head[maxn];
int f1[maxn][maxn],f2[maxn][maxn];
int corn[maxn];
int sum;
void edge(int x,int y,int c)
{
e[cnt].from=x;
e[cnt].to=y;
e[cnt].money=c;
e[cnt].next=head[x];
head[x]=cnt++;
}
void tree_dp(int i)
{
if(i<=n-m)
for (int j=head[u];!j;j=e[j].next)
{
tree_dp(e[i].to);
}
else { }
}
void work()
{
n=read(),m=read();
for(int i=;i<=n-m;i++)
{
int q,w;
q=read();
for(int j=;j<=q;j++)
{
int a,b;
a=read(),b=read();
addedge(i,a,b);
addedge(a,i,b);
}
}
for (int i=;i<=m;i++)
scanf("%d",c[i]),sum+=c[i];
tree_dp();
printf("%d",ans);
}
int main()
{
work();
return ;
}

最新文章

  1. 【转】Sublime Text3注册码(可用)
  2. WebMidiLink
  3. java-代理模式及动态代理
  4. call &amp; apply
  5. new[]上面居然有一个内存计数,怪不得delete[]从来不出错
  6. mysql wait_timeout和interactive_timeout总结
  7. [转] CSS direction属性简介与实际应用 ---张鑫旭
  8. JBoss EAP6/AS7/WildFly: How to Use Properties Files Outside Your Archive--reference
  9. Java并发编程深入学习
  10. Codeforces_499C:Crazy Town(计算几何)
  11. Linux 删除目录与文件
  12. 如何在本地搭建DVWA环境
  13. ExcelDna项目完整工程演示及讲解
  14. theano使用GPU踩坑
  15. NOIP模拟赛-2018.11.5
  16. TCP 和 UDP 在socket编程中的区别(转)
  17. ZooKeeper(二)Java API使用
  18. ZOJ 2017 Quoit Design 经典分治!!! 最近点对问题
  19. bat薪酬
  20. Hibernate中createCriteria即QBC查询的详细用法

热门文章

  1. 构建自己的PHP框架(Twig模板引擎)
  2. 本文摘录 - FlumeJava
  3. HDOJ 2189 悼念512四川汶川大地震遇难者——来生一起走 【生成函数】
  4. 解压压缩文件报错gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now
  5. easyui Full Layout
  6. 数据库访问工具 DBUtl(公孙二狗)
  7. WPF的逻辑树和视觉树
  8. git/github初级运用自如 (good)
  9. 【Gerrit】持续集成工具Jenkins的安装配置与使用过程中遇到的问题整理
  10. iOS UILabel显示html标签