题解
这道题我一直想着用dp来解,因为我觉得和01背包很像。
但是这个容量数据没办法用数组表示,所以一直想不到解法。
我默认dfs是会指数爆炸的不好解法,所以一开始就没考虑,但这题的数据很弱…
代码
#include <iostream>
#include <cstdio>
#include <fstream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
int n,m;
int v[26],p[16][26];
int eat[16

本文介绍了USACO竞赛中2.1.4题"Healthy Holsteins"的解题过程。作者最初尝试使用动态规划(DP)方法,但由于数据特性无法直接用数组表示,导致未能找到解决方案。后来发现该问题可以用深度优先搜索(DFS)在给定的数据范围内有效解决。
最低0.47元/天 解锁文章
1023

被折叠的 条评论
为什么被折叠?



