P2918 [USACO08NOV]买干草Buying Hay 题目描述 Farmer John is running out of supplies and needs to purchase H (1 <= H <= 50,000) pounds of hay for his cows. He knows N (1 <= N <= 100) hay suppliers conveniently numbered 1..N. Supplier i sells packages t…
洛谷 P2918 [USACO08NOV]买干草Buying Hay https://www.luogu.org/problem/P2918 JDOJ 2592: USACO 2008 Nov Silver 1.Buying Hay https://neooj.com:8082/oldoj/problem.php?id=2592 题目描述 Farmer John is running out of supplies and needs to purchase H (1 <= H <= 50,0…
无限背包dp.. 因为题目中说至少到 H 磅 , 我就直接把 H * 2 了.. -------------------------------------------------------------------------- #include<cstdio> #include<algorithm> #include<cstring> #include<iostream> #define rep( i , n ) for( int i = 0 ; i…
题面:P2925 [USACO08DEC]干草出售Hay For Sale 题解:无 代码: #include<cstdio> #include<cstring> #include<iostream> using namespace std; ,maxh=; int C,H,V[maxh]; bool F[maxc]; int main(){ scanf("%d%d",&C,&H); ;i<=H;i++)scanf("…