zoukankan      html  css  js  c++  java
  • poj 3624(zeroonepack)

    题目链接:http://poj.org/problem?id=3624

    #include<iostream>
    #include<fstream>
    #include<cstring>
    using namespace std ;
    int n, m ;
    int w[4000], d[4000] ;
    int dp[20000] ;
    int max(int a, int b){
        if(a>b) return a ;
        else return b ;
    }
    int main(){
        //fstream cin("x.in") ;
        cin >> n >> m ;
        memset(dp, 0sizeof(dp)) ;
        for(int i=0; i<n; i++)
            cin >> w[i] >> d[i] ;
        for(int i=0; i<n; i++)
            for(int j=m; j>=w[i]; j--)
                dp[j] = max(dp[j], dp[j-w[i]] + d[i]) ;
        cout << dp[m] << endl ;
        return 0 ;
    }
  • 相关阅读:
    poj1837 Balance

    字符流
    字节流
    File类
    this和static
    异常
    接口
    抽象类
    多态
  • 原文地址:https://www.cnblogs.com/xiaolongchase/p/2189380.html
Copyright © 2011-2022 走看看