题意:有一个有线电视网络叶子结点是用户,每个用户有一个愿意支付的金额。然后每条边都有话费。问公司在不亏本的情况下最多能满足多少用户。思路:dp[v][j]
= max(dp[v][j], dp[v][j-k]+dp[x][k]-edge(v, x))其实就是背包问题,但是一开始TLE了一次,这里要有...
分类:
其他好文 时间:
2014-05-06 00:04:24
阅读次数:
318
Given a binary tree containing digits from 0-9
only, each root-to-leaf path could represent a number.An example is the
root-to-leaf path 1->2->3 which...
分类:
其他好文 时间:
2014-05-05 23:55:36
阅读次数:
407
Problem DescriptionFor a sequence S1, S2, ... , SN,
and a pair of integers (i, j), if 1 2 #include 3 #include 4 #include 5 using
namespace std...
分类:
其他好文 时间:
2014-05-05 23:50:08
阅读次数:
445
转自http://www.cnblogs.com/qixuejia/archive/2010/07/14/1777105.html1.聚合函数(1)AVG函数功能返回组中值的平均值。空值将被忽略语法AVG([
ALL | DISTINCT ] expression)(2)MAX函数功能返回表达式的最...
分类:
数据库 时间:
2014-05-05 23:23:05
阅读次数:
560
Given two binary strings, return their sum
(also a binary string).For example,a ="11"b
="1"Return"100".思路:一个二进制字符串相加;首先从字符串的末尾开始,先二进制字符转化为数字,然后再相加;然后将...
分类:
其他好文 时间:
2014-05-05 23:10:15
阅读次数:
319
题目链接再水一发,构造啊,初始化啊。。。wa很多次啊。。#include #include
#include #include #include #include #include using namespace std;#define MOD
1000000007#define LL long l...
分类:
其他好文 时间:
2014-05-05 23:04:05
阅读次数:
375
# Definition for a binary tree node# class
TreeNode:# def __init__(self, x):# self.val = x# self.left = None# self.right
...
分类:
其他好文 时间:
2014-05-05 22:56:23
阅读次数:
419
本文出自:http://blog.csdn.net/svitter
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2191
题意:多重背包问题。转换成为01背包解。多重背包转化为01背包的关键在于把件数从整体中孤立出来作为一个新的个体,也就是说不管分类,有多少件就有多少种。
AC代码:
//======================...
分类:
其他好文 时间:
2014-05-04 00:33:10
阅读次数:
356
此题我用了2种方法去做,bfs和双向 bfs 现在还在学A*,准备学会了再用A*去试试,单向bfs只过了poj,双向bfs全部都过了,具体思想就是搜索加判重,有用hash,有用康托展开,不过康托展开比较方便,因为毕竟可以一一对应,就不用判重的时候还要比较9个数了,康托展开的计算方法是:从最高位开始,在它位数前面比它小的所有数的数量再乘以它(位数-1)的阶乘,再把每一位的这个值给加起来,就是要求的。...
分类:
其他好文 时间:
2014-05-03 17:25:28
阅读次数:
321
A + B
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 11543 Accepted Submission(s): 6699
Problem Description
读入两个小于100的正整数A和B,计...
分类:
其他好文 时间:
2014-05-03 16:00:57
阅读次数:
270