亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

hdu 1963 Investment (完全背包)

2019-11-11 04:00:52
字體:
來源:轉載
供稿:網友
PRoblem DescriptionJohn never knew he had a grand-uncle, until he received the notary’s letter. He learned that his late grand-uncle had gathered a lot of money, somewhere in South-America, and that John was the only inheritor.John did not need that much money for the moment. But he realized that it would be a good idea to store this capital in a safe place, and have it grow until he decided to retire. The bank convinced him that a certain kind of bond was interesting for him. This kind of bond has a fixed value, and gives a fixed amount of yearly interest, payed to the owner at the end of each year. The bond has no fixed term. Bonds are available in different sizes. The larger ones usually give a better interest. Soon John realized that the optimal set of bonds to buy was not trivial to figure out. Moreover, after a few years his capital would have grown, and the schedule had to be re-evaluated.Assume the following bonds are available:Value Annual interest4000   4003000   250With a capital of 10 000 one could buy two bonds of 4 000, giving a yearly interest of 800. Buying two bonds of 3 000, and one of 4 000 is a better idea, as it gives a yearly interest of 900. After two years the capital has grown to 11 800 , and it makes sense to sell a 3 000 one and buy a 4 000 one, so the annual interest grows to 1 050. This is where this story grows unlikely: the bank does not charge for buying and selling bonds. Next year the total sum is 12 850, which allows for three times 4 000, giving a yearly interest of 1 200. Here is your problem: given an amount to begin with, a number of years, and a set of bonds with their values and interests, find out how big the amount may grow in the given period, using the best schedule for buying and selling bonds. InputThe first line contains a single positive integer N which is the number of test cases. The test cases follow. The first line of a test case contains two positive integers: the amount to start with (at most 1 000 000), and the number of years the capital may grow (at most 40). The following line contains a single number: the number d (1 <= d <= 10) of available bonds.The next d lines each contain the description of a bond. The description of a bond consists of two positive integers: the value of the bond, and the yearly interest for that bond. The value of a bond is always a multiple of $1 000. The interest of a bond is never more than 10% of its value. OutputFor each test case, output – on a separate line – the capital at the end of the period, after an optimal schedule of buying and selling. Sample Input
110000 424000 4003000 250 Sample Output
14050 SourceNWERC2004 題意:給出初始資金,還有年數,然后給出每個物品的購買價格與每年獲得的利益,每個物品可選多次,要求在給出的年份后所能得到的最大本利之和。思路:由于給出的資金過大,循環會超時,題目說了本金與物品的購買價格都是1000的倍數,所以我們可以將他們都除以1000來進行壓縮,然后就是一道完全背包模板題了。代碼:
#include<cstdio>#include<algorithm>#include<cstring>using namespace std;const int N=20;const int M=500000;int dp[M];struct node{    int a,b;}str[N];int main(){    int T;    scanf("%d",&T);    while(T--)    {        int a,t;        scanf("%d%d",&a,&t);        int n;        scanf("%d",&n);        for(int i=0;i<n;i++)        {            scanf("%d%d",&str[i].a,&str[i].b);            str[i].a/=1000;        }        for(int i=1;i<=t;i++)        {            int ans=a/1000;            memset(dp,0,sizeof(dp));            for(int j=0;j<n;j++)                for(int k=str[j].a;k<=ans;k++)                    dp[k]=max(dp[k],dp[k-str[j].a]+str[j].b);            a+=dp[ans];        }        printf("%d/n",a);    }}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
日本精品久久久久影院| 欧美不卡视频一区发布| 亚洲综合色激情五月| 91视频九色网站| 欧美午夜影院在线视频| 亚洲第一中文字幕在线观看| 欧美成人激情图片网| 91免费高清视频| 欧美一区深夜视频| 久久精品国产一区二区三区| 成人免费高清完整版在线观看| 国产精品扒开腿做爽爽爽的视频| 欧美色播在线播放| 欧美高清不卡在线| 欧美一级大胆视频| 久久久亚洲欧洲日产国码aⅴ| 午夜精品免费视频| 国产午夜精品一区理论片飘花| 激情亚洲一区二区三区四区| 亚洲精品456在线播放狼人| 欧美夫妻性生活视频| 亚洲人高潮女人毛茸茸| 38少妇精品导航| 欧美主播福利视频| 国产精品私拍pans大尺度在线| 国产成人一区二区三区电影| 国产精品久久久久9999| 日韩精品999| 欧美与黑人午夜性猛交久久久| 欧美激情一区二区三级高清视频| 国产成人精品久久| 国产精品精品视频一区二区三区| 亚洲成人在线视频播放| 日本亚洲欧美成人| 国产91精品不卡视频| 国产精品久久久久国产a级| 韩国视频理论视频久久| 国外成人在线直播| 国产亚洲精品久久久久久777| 美女国内精品自产拍在线播放| 国产精品视频区1| 亚洲国产精品嫩草影院久久| 亚洲国产精品美女| 亚洲精品一区二区三区不| 国产欧美日韩免费看aⅴ视频| 国产美女91呻吟求| 久久国内精品一国内精品| 国产精品十八以下禁看| 亚洲欧美中文日韩在线v日本| 日韩av网址在线观看| 欧美一区三区三区高中清蜜桃| 91久久夜色精品国产网站| 久久综合免费视频影院| 日韩精品视频中文在线观看| 国产精品96久久久久久| 中日韩美女免费视频网址在线观看| 欧美日韩国产综合视频在线观看中文| 成人国产精品免费视频| 国产精品久久久久久久久久| 97在线观看视频| 一区三区二区视频| 欧美一级淫片videoshd| 日韩精品中文字幕在线观看| 不卡av在线网站| 成人亲热视频网站| 成人免费在线视频网址| 日本道色综合久久影院| 日韩欧美有码在线| 日本成人在线视频网址| 在线国产精品视频| 久久精品国产清自在天天线| 国产精品草莓在线免费观看| 九九精品在线视频| 在线成人一区二区| 亚洲精品中文字幕av| 国产91精品久久久| 岛国av一区二区三区| 国产成人精品电影久久久| 91精品国产综合久久香蕉最新版| 亚洲精品98久久久久久中文字幕| 亚洲精品色婷婷福利天堂| 91精品久久久久久| 日产日韩在线亚洲欧美| 一本一道久久a久久精品逆3p| 日韩在线视频二区| 91精品综合久久久久久五月天| 国内成人精品一区| 国产精品成久久久久三级| 亚洲黄一区二区| 午夜精品久久久久久久白皮肤| 日韩黄色高清视频| 国产91ⅴ在线精品免费观看| 国产一区二区三区在线视频| 2021久久精品国产99国产精品| 日韩大片免费观看视频播放| 美女久久久久久久久久久| 日本精品久久中文字幕佐佐木| 国产小视频91| 日韩av最新在线| 2019精品视频| 亚洲激情视频在线观看| 亚洲一区二区中文字幕| 91在线中文字幕| 国产成人午夜视频网址| 91av在线网站| 成人激情春色网| 精品视频一区在线视频| 91在线高清免费观看| 久久久国产精品x99av| 亚洲最新在线视频| 国产一区二区三区丝袜| 一区二区av在线| 国产精品日韩av| 伊是香蕉大人久久| 国产精品亚洲激情| 欧美另类暴力丝袜| 中文.日本.精品| 亚洲男女自偷自拍图片另类| 中文字幕一区日韩电影| 国产成人精品免费久久久久| 中文字幕亚洲一区二区三区| 国产精品青青在线观看爽香蕉| 亚洲伊人一本大道中文字幕| 国产欧美久久一区二区| 亚洲精品免费在线视频| 久久久女人电视剧免费播放下载| 91久久精品日日躁夜夜躁国产| 欧美日韩国产区| 欧美日韩午夜视频在线观看| 国产精品久久久久久av福利软件| 国产精品欧美日韩| 午夜精品www| 日本电影亚洲天堂| 日本午夜精品理论片a级appf发布| 国产精品久久9| 精品久久久久久久大神国产| 中文字幕日韩在线视频| 国产欧美 在线欧美| 国产精品美女免费看| 亚洲丝袜在线视频| 尤物九九久久国产精品的分类| 亚洲一区二区三区四区在线播放| 国产精品视频免费在线| 久久久国产成人精品| 亚洲色图激情小说| 亚洲欧美一区二区三区四区| 亚洲摸下面视频| 久久在线免费观看视频| 国产精品永久免费观看| 日本19禁啪啪免费观看www| 欧美日韩在线看| 亚洲精品欧美极品| 国产精品视频播放| 播播国产欧美激情| 亚洲深夜福利网站| 青青草一区二区| 91爱视频在线| 中文字幕亚洲欧美日韩2019| 欧美国产第一页| 国精产品一区一区三区有限在线| 国产成人+综合亚洲+天堂| 久久久久久成人| 亚洲福利视频在线| 国产精品久久久久久久久影视|