初学DP,用贪心的思想想解题,可是想了一个多小时还是想不出。//在max中的两个参数f[k], 和f[k-weight[i]]+value[i]都是表示在背包容量为k时的最大价值 //f[k]是这个意思,就不用说了。 //而f[k-weight[i]]+value[i]也表示背包容量为k时的...
分类:
其他好文 时间:
2014-07-22 00:32:34
阅读次数:
165
Y2K Accounting BugTime Limit:1000MSMemory Limit:65536KTotal Submissions:10210Accepted:5083DescriptionAccounting for Computer Machinists (ACM) has suff...
分类:
其他好文 时间:
2014-07-22 00:25:37
阅读次数:
177
Agri-Net
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 38805
Accepted: 15674
Description
Farmer John has been elected mayor of his town! One of his campa...
分类:
其他好文 时间:
2014-07-21 14:12:34
阅读次数:
278
题目来源:POJ 2955 Brackets
题意:最大括号匹配
思路:
#include
#include
#include
#include
using namespace std;
const int maxn = 210;
int dp[maxn][maxn];
char a[maxn];
int b[maxn];
int dfs(int l, int r)
{
if(l ...
分类:
其他好文 时间:
2014-07-21 14:07:05
阅读次数:
178
Agri-Net
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 38809
Accepted: 15676
Description
Farmer John has been elected mayor of his town! One of his campa...
分类:
Web程序 时间:
2014-07-21 14:04:09
阅读次数:
312
Highways
Description
The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is aware...
分类:
其他好文 时间:
2014-07-21 14:03:40
阅读次数:
184
Cash Machine
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 26926
Accepted: 9518
Description
A Bank plans to install a machine for cash withdrawal. The ma...
分类:
其他好文 时间:
2014-07-21 14:00:08
阅读次数:
170
题意就是一颗星星的左下方有多少颗星星就是几级;
把每级的星星个数统计好输出就ok;
但不能用二维树状数组,会超内存,,
#include
#include
#include
#define maxn 32001
using namespace std;
int a;
int arr[maxn];
int low(int x)
{
return x&(-x);
}
void u...
分类:
其他好文 时间:
2014-07-21 13:38:26
阅读次数:
213
枚举+最短路问题。
题意依然晦涩难懂。
新建一个消防站n 可以使得所有交叉路口到最近的一个消防站的距离中最大值减小,且n 是满足条件的交叉路口序号中序号最小的。
先每个消防站做SPFA。找到所有点 到最近消防站的 距离。
然后枚举 每个不是消防站的点,找到距离这个点的最大距离。然后比对 最大是否更新了。
ORZ的是,输入边的时候要EOF。简直……
谁是出...
分类:
其他好文 时间:
2014-07-21 13:21:36
阅读次数:
205
Highway
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 871
Accepted: 402
Description
Bob is a skilled engineer. He must design a highway that crosses a ...
分类:
其他好文 时间:
2014-07-21 11:23:56
阅读次数:
176