摘要:
P1090 [NOIP2004 提高组] 合并果子 / [USACO06NOV] Fence Repair G这是一道贪心算法的题目,用BST维护有序性,每次取最小值,并删除,取两次合并为新的一堆,进行n-1次,这样就合并为一堆了统计过程每一次的大小。指针版 #include<bits/stdc++ 阅读全文
摘要:
P1926 小书童——刷题大军 #include<iostream> #include<algorithm> using namespace std; int dp[200]; int a[20],b[20],c[20]; int n,m,k,r; int main() { cin>>n>>m>>k 阅读全文
摘要:
P2639 [USACO09OCT]Bessie's Weight Problem G #include<iostream> using namespace std; long long dp[45001]; int s[501]; int main() { int N,H; cin>>H>>N; 阅读全文
摘要:
P2871 [USACO07DEC]Charm Bracelet S #include<iostream> using namespace std; long long dp[12881]; int D[3500],W[3500]; int main() { int N,M; cin>>N>>M; 阅读全文
摘要:
P2925 [USACO08DEC]Hay For Sale S #include<iostream> using namespace std; long long dp[50001]; int h[5001]; int main() { int C,H; cin>>C>>H; for (int i 阅读全文
摘要:
P1802 5 倍经验日 #include<iostream> #include<cstring> using namespace std; const int Maxn=1100; long long dp[Maxn],lose[Maxn],win[Maxn],used[Maxn]; long l 阅读全文
摘要:
P1877 [HAOI2012]音量调节 #include<cstdio> using namespace std; int n,begin,maxlevel; int ans; int a[51]; bool f[51][1001]; int main() { scanf("%d%d%d",&n, 阅读全文
摘要:
P1510 精卫填海 #include<iostream> using namespace std; long long dp[45001]; int s[10001],t[10001]; int main() { int v,n,c; cin>>v>>n>>c; for (int i=1;i<=n 阅读全文
摘要:
P1048 [NOIP2005 普及组] 采药解法一 #include<iostream> #include<cstring> using namespace std; const int Maxn=110; const int Maxv=1010; int V,n,ans=0; int w[Max 阅读全文
摘要:
01背包给定 n 件物品,物品的重量为 w[i],物品的价值为 c[i]。现挑选物品放入背包中,假定背包能承受的最大重量为 V,问应该如何选择装入背包中的物品,使得装入背包中物品的总价值最大?搜索算法状态i表示考虑第i件物品,v表示当前背包重量,C表示当前最大价值。dfs(i,v,C)调用方式dfs 阅读全文