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

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

hdu 1963 Investment (完全背包)

2019-11-11 03:59:12
字體:
來源:轉載
供稿:網友
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);    }}
上一篇:Qt中文顯示亂碼

下一篇:oracle權限

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
永久免费精品影视网站| 欧美第一黄网免费网站| 日韩在线观看免费高清| 国产偷国产偷亚洲清高网站| 97在线视频免费观看| 日韩中文字幕精品视频| 欧美综合国产精品久久丁香| 成人免费视频网| 97国产精品视频人人做人人爱| 亚洲欧美日本另类| 欧美视频裸体精品| 国产精品免费视频久久久| 热久久这里只有| 日韩av成人在线| 欧美亚洲视频在线看网址| 欧美精品成人在线| 久久久久久亚洲精品| 国产精品成人在线| 国产精品大陆在线观看| 日韩中文在线中文网三级| 久久精品国产综合| xvideos亚洲人网站| 精品久久久久久中文字幕一区奶水| 亚洲色图狂野欧美| 欧美制服第一页| 欧美国产日本在线| 88xx成人精品| 国产精品免费久久久久久| 久久久电影免费观看完整版| 日韩va亚洲va欧洲va国产| 精品久久久91| 国产香蕉97碰碰久久人人| 亚洲国产一区二区三区四区| 国产精品久久久久久久久久| 亚洲精品久久7777777| 久久亚洲综合国产精品99麻豆精品福利| 北条麻妃久久精品| 中文字幕在线看视频国产欧美在线看完整| 国产91ⅴ在线精品免费观看| 亚洲区中文字幕| 国产一区二区三区在线观看网站| 亚洲国产精品女人久久久| 色琪琪综合男人的天堂aⅴ视频| 色婷婷久久一区二区| 亚洲精品国产精品乱码不99按摩| 97成人精品视频在线观看| 亚洲国产小视频在线观看| 日韩电影免费在线观看| 欧美视频在线看| 日韩av电影在线网| 日韩三级成人av网| 麻豆国产精品va在线观看不卡| 一色桃子一区二区| 国产成人一区二区三区| 91精品国产高清久久久久久91| 日韩在线观看电影| 成人做爽爽免费视频| 精品国产成人在线| 国产精品久久久一区| 日韩少妇与小伙激情| 日韩免费电影在线观看| 午夜免费在线观看精品视频| 日韩电影中文字幕av| 97av在线影院| 亚洲成人在线视频播放| 影音先锋欧美精品| 91精品国产自产在线老师啪| 亚洲国产精品va在线看黑人动漫| 粉嫩av一区二区三区免费野| 91精品国产777在线观看| 久久精品国产精品亚洲| 亚洲精品视频在线播放| 欧美极度另类性三渗透| 亚洲精选一区二区| 国产日韩视频在线观看| 国产精品永久免费在线| xxxxx91麻豆| 久久男人的天堂| 日韩中文字幕在线免费观看| 久久国产精品久久国产精品| 亚洲欧美另类人妖| 国产一区二区三区中文| 在线观看精品国产视频| 亚洲欧美日韩中文在线| 欧美日韩中国免费专区在线看| 91九色单男在线观看| 中文字幕日韩免费视频| 欧美极品美女电影一区| 欧美高跟鞋交xxxxhd| 日韩经典中文字幕| 久久久免费在线观看| 日韩h在线观看| 中文字幕亚洲欧美日韩在线不卡| 免费91麻豆精品国产自产在线观看| 91av在线免费观看| 欧美久久精品午夜青青大伊人| 亚洲精品综合久久中文字幕| 久久香蕉国产线看观看网| 亚洲美女精品久久| 日韩极品精品视频免费观看| 91中文字幕在线| 亚洲a成v人在线观看| 国产成人小视频在线观看| 欧美国产欧美亚洲国产日韩mv天天看完整| 97视频在线免费观看| 亚洲国产日韩欧美在线动漫| 国产91免费看片| 91久久久精品| 国产欧美一区二区三区在线| 国产精品一区专区欧美日韩| 国产成人黄色av| 亚洲欧美三级伦理| 精品国偷自产在线| xxxx性欧美| 97成人精品区在线播放| 亚洲色图国产精品| 欧美一区二区三区图| 国产精品久久久久免费a∨大胸| 欧美成年人在线观看| 91精品久久久久久综合乱菊| 精品国产一区二区三区久久久狼| 国产成人欧美在线观看| 伊人伊成久久人综合网站| 亚洲大胆人体视频| 国产不卡一区二区在线播放| 欧美夜福利tv在线| 日韩av在线资源| 中文字幕一区二区三区电影| 亚洲一级片在线看| 亚洲欧美国产高清va在线播| 不卡av在线播放| 久久精品视频在线观看| 欧美激情第1页| 亚洲精选一区二区| 亚洲福利在线播放| 欧美亚洲成人免费| 国产精品精品视频一区二区三区| 日韩久久午夜影院| 色综合久久久久久中文网| 国产男女猛烈无遮挡91| 国产欧美在线看| 亚洲欧美中文字幕在线一区| 亚洲视频网站在线观看| 国产伦精品一区二区三区精品视频| 欧美激情久久久久| 久久综合五月天| 国产精品久久久久久久久久ktv| 国产精品久久久久免费a∨大胸| 国产丝袜一区视频在线观看| 欧美激情综合色| 国产高清在线不卡| …久久精品99久久香蕉国产| 91精品国产乱码久久久久久久久| 日本精品中文字幕| 啊v视频在线一区二区三区| 国产91色在线|免| 久久久久久国产精品三级玉女聊斋| 欧美成人精品不卡视频在线观看| 国产97在线亚洲| 亚洲男人的天堂网站| 青青久久av北条麻妃黑人| 青青草国产精品一区二区| 日韩最新中文字幕电影免费看| 九色成人免费视频|