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

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

hdu 1963 Investment (完全背包)

2019-11-11 04:39:35
字體:
來源:轉載
供稿:網友
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
欧美日本中文字幕| 欧美超级免费视 在线| 国产亚洲在线播放| 中文字幕日韩综合av| 久久久精品日本| 国产精品偷伦免费视频观看的| 亚洲美女av在线| 国产精品久久久久久久久久新婚| 欧美猛少妇色xxxxx| 欧美重口另类videos人妖| 热re91久久精品国99热蜜臀| 亚洲乱码国产乱码精品精天堂| 在线日韩欧美视频| 久久韩剧网电视剧| 亚洲免费影视第一页| 久久天天躁狠狠躁老女人| 亚洲a∨日韩av高清在线观看| 精品久久久久久久大神国产| 午夜伦理精品一区| 日韩欧美亚洲国产一区| 理论片在线不卡免费观看| 国产精品一区二区三区久久久| 欧美高清在线观看| 国产精品成人在线| 国产精品亚洲片夜色在线| 美日韩丰满少妇在线观看| 亚洲精品v欧美精品v日韩精品| 热门国产精品亚洲第一区在线| 国产一区二中文字幕在线看| 国产精品免费久久久久久| 亚洲人成网站999久久久综合| 伊是香蕉大人久久| 91中文字幕在线观看| 精品久久在线播放| 久久久久久久久久久网站| 日韩中文字幕第一页| 欧美精品免费在线观看| 97在线观看免费高清| 91中文精品字幕在线视频| 国产婷婷成人久久av免费高清| 欧美不卡视频一区发布| 在线免费看av不卡| 亚洲在线观看视频网站| 色999日韩欧美国产| 久久香蕉国产线看观看网| 国语自产精品视频在线看| 午夜精品久久久久久久男人的天堂| 日韩视频亚洲视频| 九九热这里只有精品免费看| 国外成人性视频| 欧日韩不卡在线视频| 欧美日韩精品在线视频| 欧美极品少妇xxxxⅹ免费视频| 成人网在线视频| 日韩电影免费观看在线| 国产成人精品一区二区三区| 国外色69视频在线观看| 尤物tv国产一区| 久久伊人精品天天| 欧美激情免费看| 亚洲第五色综合网| 18一19gay欧美视频网站| 日韩欧美在线国产| 日韩不卡中文字幕| 亚洲黄色在线观看| 国产精品亚洲视频在线观看| 国产精品网站大全| 亚洲精品美女在线| 亚洲xxxx在线| 欧美一级高清免费| 91免费视频国产| 成人免费看吃奶视频网站| 亚洲乱亚洲乱妇无码| 中文字幕日韩有码| 欧美性在线观看| 亚洲日韩欧美视频一区| 久青草国产97香蕉在线视频| 色婷婷亚洲mv天堂mv在影片| 国产精品第一页在线| 国产精品久久久久99| 91精品国产高清久久久久久| 色偷偷88888欧美精品久久久| 精品久久久视频| 欧美日韩综合视频网址| 亚洲毛茸茸少妇高潮呻吟| 亚洲女人天堂成人av在线| 国产亚洲精品成人av久久ww| 国模私拍一区二区三区| 国产精品18久久久久久麻辣| 国产精品成av人在线视午夜片| 亚洲色图综合网| 欧美猛交ⅹxxx乱大交视频| 亚洲人成电影网站色| 成人午夜在线观看| 综合网日日天干夜夜久久| 欧美日韩第一视频| 成人黄在线观看| 亚洲成人网久久久| 国外成人在线直播| 日韩女在线观看| 欧美成人精品一区| 性色av香蕉一区二区| 欧美国产精品日韩| 欧美黑人国产人伦爽爽爽| 欧美电影免费观看电视剧大全| 日本19禁啪啪免费观看www| 成人乱色短篇合集| 欧美噜噜久久久xxx| 日韩不卡中文字幕| 欧美极品少妇全裸体| 97精品一区二区视频在线观看| 亚洲影院色无极综合| 亚州精品天堂中文字幕| 国产精品入口尤物| 欧美日韩国产精品| 丝袜美腿亚洲一区二区| 欧美日产国产成人免费图片| 92福利视频午夜1000合集在线观看| 欧美日韩激情视频8区| 中文字幕日韩专区| 久久99久久久久久久噜噜| 国产精品wwwwww| 国产aⅴ夜夜欢一区二区三区| 亚洲欧美另类人妖| 国产精品专区一| 国产亚洲福利一区| 亚洲成人黄色在线观看| 久久99国产综合精品女同| 欧美高清在线视频观看不卡| 亚洲欧洲av一区二区| 久久久久久久久国产精品| 欧美日韩不卡合集视频| 成年人精品视频| 日韩精品高清在线| 欧美成人精品激情在线观看| 国产精品夜间视频香蕉| 亚洲欧美综合另类中字| 91精品国产91久久久久| 中文字幕v亚洲ⅴv天堂| 国产精品影院在线观看| 亚洲国产精品热久久| 久久久国产91| 日韩禁在线播放| 欧美极品少妇全裸体| 国产成人久久久| 日韩成人在线视频网站| 国产日韩精品视频| 中文字幕在线日韩| 亚洲自拍高清视频网站| 538国产精品一区二区免费视频| 91久久国产精品91久久性色| 亚洲精品动漫久久久久| 久久久精品在线| 日韩精品在线观看一区二区| 日韩精品免费在线播放| 成人两性免费视频| 国产精品成人在线| 激情懂色av一区av二区av| 久久久久国产视频| y97精品国产97久久久久久| 日韩视频中文字幕| 国产丝袜视频一区| 国产91亚洲精品| 欧美精品成人91久久久久久久|