HDOJ 1248


无聊题。。。。
#include <iostream>
#include <string.h>

using namespace std;

int V;

int f[10000];

void Cpake(int cost)
{
    for(int i=cost;i<=V;i++)
        f=max(f,f[i-cost]+cost);
}

int main()
{
    int n;
    cin>>n;

    int t[3]={150,200,350};

    for(int k=0;k<n;k++)
    {
        memset(f,0,sizeof(f));
        cin>>V;
        for(int i=0;i<3;i++)
        {
            Cpake(t);
        }

        //for(int i=0;i<=V;i++)
            cout<<V-f[V];

        cout<<endl;
    }

    return 0;
}

posted @ 2013-04-03 04:43  码代码的猿猿  阅读(131)  评论(0编辑  收藏  举报