zoukankan      html  css  js  c++  java
  • 51nod 01背包

    #include<cstdio>
    #include<algorithm>
    #define REP(i, a, b) for(int i = (a); i < (b); i++)
    using namespace std;
    
    const int MAXN = 11234;
    int f[MAXN];
    
    int main()
    {
    	int n, m;
    	scanf("%d%d", &n, &m);
    	REP(i, 0, n)
    	{
    		int w, v;
    		scanf("%d%d", &w, &v);
    		for(int j = m; j >= w; j--)
    			f[j] = max(f[j], f[j - w] + v);
    	} 
    	printf("%d
    ", f[m]);
    	return 0;	
    } 
  • 相关阅读:
    *Path Sum II
    *Path Sum
    Same Tree
    Symmetric Tree
    hprof网络连接
    gc
    java thread park
    sudo !!
    ecb gud
    jpda
  • 原文地址:https://www.cnblogs.com/sugewud/p/9819441.html
Copyright © 2011-2022 走看看