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

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

hdu 1963 Investment (完全背包)

2019-11-11 03:27:19
字體:
來源:轉載
供稿:網友
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
2021久久精品国产99国产精品| 国产亚洲精品91在线| 国产999精品久久久影片官网| 伊人伊成久久人综合网站| 亚洲色图日韩av| 91久久精品国产| 日韩精品在线视频美女| 中日韩午夜理伦电影免费| 日韩欧美精品在线观看| 欧美福利视频网站| www国产精品com| 欧美中文字幕精品| 欧美极品少妇xxxxx| 国产亚洲精品美女久久久| 91精品国产高清久久久久久91| 欧美激情啊啊啊| 欧美性猛交xxxx黑人猛交| 久久综合免费视频影院| 日本精品久久中文字幕佐佐木| 亚洲国产精品资源| 亚洲成人性视频| 欧美电影在线观看| 欧美日韩亚洲视频一区| 夜夜嗨av色综合久久久综合网| 国产精品自拍偷拍视频| 日韩小视频在线观看| 4k岛国日韩精品**专区| 久久中文字幕一区| 中文字幕亚洲无线码a| 色多多国产成人永久免费网站| 亚洲国产一区二区三区四区| 国产美女被下药99| 亚洲自拍高清视频网站| 久久99视频免费| 久久成人精品电影| 国产精品va在线播放| 中文字幕日韩在线播放| 日日噜噜噜夜夜爽亚洲精品| 亚洲直播在线一区| 精品视频一区在线视频| 日韩一区二区精品视频| 欧美第一淫aaasss性| 日韩精品黄色网| 亚洲精品女av网站| 日韩成人在线播放| 一本色道久久综合亚洲精品小说| 国产午夜精品全部视频在线播放| 亚洲福利视频网| 91av在线免费观看| 久久香蕉频线观| 日韩视频亚洲视频| 国产精品夫妻激情| 亚洲欧美精品一区| 欧美另类老肥妇| 欧美高跟鞋交xxxxxhd| 欧美日韩999| 亚洲理论片在线观看| 日韩av一区在线观看| 国产一区二区三区在线免费观看| 国语自产精品视频在线看抢先版图片| 久久韩剧网电视剧| 久久久久亚洲精品国产| 亚洲日韩欧美视频| www.日韩.com| 亚洲激情电影中文字幕| 91wwwcom在线观看| 成人福利视频在线观看| 欧美在线视频一区二区| 亚洲男人第一av网站| 中文字幕av一区中文字幕天堂| 日韩不卡在线观看| 精品久久久久久久大神国产| 97在线看免费观看视频在线观看| 欧美亚洲另类在线| 亚洲视频在线观看免费| 91免费人成网站在线观看18| 色综久久综合桃花网| 亚洲天堂av图片| 91在线视频一区| 亚洲娇小xxxx欧美娇小| 欧美性猛交xxx| 成人在线国产精品| 国产精品偷伦视频免费观看国产| 日韩视频―中文字幕| 精品久久久久久国产91| 欧美亚洲在线播放| 国产精品久久久久久久久免费| 91成人精品网站| 亚洲性线免费观看视频成熟| 亚洲黄色av女优在线观看| 色老头一区二区三区在线观看| 91视频九色网站| 亚洲精品国产综合区久久久久久久| 午夜精品福利视频| 亚洲欧洲成视频免费观看| 91精品国产自产在线观看永久| 亚洲自拍高清视频网站| 91香蕉嫩草神马影院在线观看| 国语自产精品视频在免费| 91精品国产一区| 国产va免费精品高清在线观看| 亚洲美女激情视频| 国产成人综合亚洲| 欧美日韩亚洲一区二区三区| 亚洲欧美一区二区三区情侣bbw| 日韩av电影免费观看高清| 久久综合网hezyo| 欧美国产亚洲精品久久久8v| 国产99久久精品一区二区 夜夜躁日日躁| 8x海外华人永久免费日韩内陆视频| 日韩欧美成人网| 午夜伦理精品一区| 精品国产欧美一区二区五十路| 亚洲18私人小影院| 亚洲人成电影网| 热久久美女精品天天吊色| 欧美伊久线香蕉线新在线| 亚洲综合精品伊人久久| 欧美大学生性色视频| 韩国精品久久久999| 青青在线视频一区二区三区| 69av成年福利视频| 色无极影院亚洲| 日韩最新中文字幕电影免费看| 欧美性xxxx18| 成人乱色短篇合集| 亚洲欧美在线免费观看| 亚洲va电影大全| 色噜噜久久综合伊人一本| 欧美亚洲激情视频| 91精品国产91久久| 久久99热这里只有精品国产| 久久久www成人免费精品张筱雨| 国产亚洲美女久久| 亚洲国产精品成人va在线观看| 午夜精品久久久99热福利| 欧美成人精品h版在线观看| 欧美激情精品久久久久久变态| 亚洲国产成人精品女人久久久| 亚洲xxxxx性| 国产成人中文字幕| 欧美精品少妇videofree| 2019中文字幕在线观看| 91精品在线国产| 欧美裸体xxxx极品少妇软件| 97精品视频在线观看| 国产精品99免视看9| 国产精品免费一区豆花| 国产精品jizz在线观看麻豆| 成年人精品视频| 日本精品免费观看| 日本欧美在线视频| 97成人精品视频在线观看| 狠狠久久五月精品中文字幕| 97免费在线视频| 久久久久久999| 欧美成人精品在线观看| 久久男人的天堂| 91探花福利精品国产自产在线| 成人国产精品久久久| 精品国内产的精品视频在线观看| 国产精品aaa| 国产欧美一区二区三区四区| 亚洲成人免费在线视频|