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

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

hdu 1963 Investment (完全背包)

2019-11-11 05:27:11
字體:
來源:轉載
供稿:網友
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
亚洲va久久久噜噜噜久久天堂| 国产精品视频在线播放| 免费99精品国产自在在线| 中文字幕亚洲情99在线| 欧美福利视频在线观看| 国产一区二区三区直播精品电影| 亚洲精品按摩视频| 欧美成人精品不卡视频在线观看| 91精品国产综合久久久久久久久| 一区二区三区天堂av| 欧美一区二粉嫩精品国产一线天| 亚洲精品国产综合区久久久久久久| 91产国在线观看动作片喷水| 韩剧1988在线观看免费完整版| 国产欧美日韩免费看aⅴ视频| 欧美成人第一页| 色偷偷88888欧美精品久久久| 亚洲视频在线观看视频| 欧美小视频在线| 成人午夜高潮视频| 久久久99免费视频| 欧美做受高潮电影o| 亚洲综合成人婷婷小说| 精品久久久久久| 亚洲男人天堂2024| 国产精品久久久久999| 91成人精品网站| 77777亚洲午夜久久多人| 久久亚洲国产成人| 懂色av中文一区二区三区天美| 久久久久一本一区二区青青蜜月| 日韩成人在线免费观看| 色婷婷久久一区二区| 亚洲成人a级网| 日韩的一区二区| 久久久91精品国产一区不卡| 97视频免费在线看| 国产精品自拍小视频| 国产一区欧美二区三区| 成人免费黄色网| 色偷偷偷亚洲综合网另类| 97香蕉超级碰碰久久免费的优势| 国产成人在线亚洲欧美| 亚洲三级av在线| 国产91精品最新在线播放| 91精品国产综合久久久久久蜜臀| 精品久久久久久久久久久久久久| 91在线视频免费| 久久久久久久久久国产| 97在线看免费观看视频在线观看| 黑人欧美xxxx| 欧美精品福利在线| 91欧美精品午夜性色福利在线| 国产精品视频自在线| 粉嫩av一区二区三区免费野| 日韩在线中文字幕| 精品久久久国产| 97在线观看免费高清| 国产精品自拍偷拍视频| 亚洲精品按摩视频| 亚洲综合小说区| 亚洲综合av影视| 久久久久久网址| 亚洲黄色片网站| 日韩不卡中文字幕| 在线观看亚洲视频| 91精品国产综合久久香蕉最新版| 国产亚洲精品va在线观看| 国产亚洲精品91在线| 欧美激情一区二区三区高清视频| 久久激情视频免费观看| 色香阁99久久精品久久久| 北条麻妃一区二区在线观看| 成人啪啪免费看| 亚洲第一区在线观看| 欧美激情免费看| 国产精品视频网| 亚洲精选一区二区| 清纯唯美日韩制服另类| 日韩大陆欧美高清视频区| 亚洲欧美国产精品va在线观看| 91av视频在线| 日韩av电影免费观看高清| 一区二区中文字幕| 91精品久久久久久久久不口人| zzijzzij亚洲日本成熟少妇| 亚洲日本欧美日韩高观看| 92福利视频午夜1000合集在线观看| 欧美日韩国产中文字幕| 国产精品igao视频| 尤物yw午夜国产精品视频| 亚洲成人免费在线视频| 国产精品视频一区二区三区四| 日韩成人激情视频| 久久av在线播放| 亚洲xxxx做受欧美| 欧美激情国内偷拍| 91最新国产视频| 久久av红桃一区二区小说| 欧美精品一本久久男人的天堂| 日韩精品小视频| www.亚洲天堂| 欧美黑人狂野猛交老妇| 亚洲天堂av在线免费观看| 欧美午夜久久久| 日本19禁啪啪免费观看www| 亚洲最大成人免费视频| 色狠狠av一区二区三区香蕉蜜桃| 亚洲欧美精品一区二区| 色视频www在线播放国产成人| 一区二区三区动漫| 2021久久精品国产99国产精品| 国产精品成人一区| 国产欧美在线视频| 日韩福利视频在线观看| 国产精品久久久久免费a∨| 亚洲片国产一区一级在线观看| 国产欧美精品日韩| 亚洲va国产va天堂va久久| 日本成人免费在线| 国产视频亚洲精品| 亚洲欧美综合精品久久成人| 日韩的一区二区| 欧美精品精品精品精品免费| 欧美国产欧美亚洲国产日韩mv天天看完整| 国产视频精品免费播放| 亚洲国产又黄又爽女人高潮的| 精品国产电影一区| 精品调教chinesegay| 91亚洲精品一区二区| 亚洲一级一级97网| 日韩欧美高清视频| 国产精品久久久久久久av电影| 欧美国产一区二区三区| 国产精品久久久久免费a∨| 亚洲精品国产电影| 成人亚洲激情网| 久久综合亚洲社区| 性欧美在线看片a免费观看| 国产91精品网站| 中文字幕久热精品视频在线| 亚洲精品视频久久| 久久久噜噜噜久久久| 一区二区三区视频免费| 在线观看亚洲区| 亚洲精品v天堂中文字幕| 久久精品夜夜夜夜夜久久| 91精品国产电影| 丝袜美腿亚洲一区二区| 久久精品成人一区二区三区| 91久久精品久久国产性色也91| 欧美成年人视频网站| 欧美日韩免费观看中文| 亚洲天堂色网站| 久久综合伊人77777尤物| 国产成人在线视频| 国产精品尤物福利片在线观看| 91久久精品美女| 亚洲第一精品福利| 精品久久久视频| 亚洲国产日韩一区| 奇米一区二区三区四区久久| 亚洲综合成人婷婷小说| 欧美激情亚洲自拍|