• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            http://acm.hdu.edu.cn/showproblem.php?pid=2809
            HH大牛出的題目,比賽的時候被唬住了沒有去做,今天興致來了認真敲了一下,秒殺
            這題跟1074doing homework一樣,位壓縮,沒的說,自底向上計算,見圖

            #include<iostream>
            using namespace std;
            #define N 1100000
            int m,n,hp,ati,def;
            struct node{
                
            int ati;
                
            int def;
                
            int hp;
                
            int lv;
                
            int exp;
            }
            q[N],tt;
            struct man{
                
            int ati;
                
            int def;
                
            int hp;
                
            int exp;
            }
            man[21];
            int max(int a,int b)
            {
                
            return a>b?a:b;
            }

            int war(int j,int i)
            {
                
            int time;
                time
            =man[i].hp/max(1,q[j].ati-man[i].def);
                
            if(man[i].hp%max(1,q[j].ati-man[i].def)==0)
                    time
            --;
                
            if(time>=0)
                    
            return time;
                
            return -1;
            }



            void dp()
            {
                
            int i,j,time,add,temp,next;    
                
            for(j=0;j<m;j++)
                
            {
                    
            if(q[j].hp<=0)
                        
            continue;
                    
            for(i=0;i<n;i++)
                    
            {
                        temp
            =j>>i;
                        
            if(temp&1)
                            
            continue;
                        
            else
                            next
            =j+(1<<i);
                        
            if((time=war(j,i))==-1)
                            
            continue;//戰(zhàn)斗失敗,continue
                        tt=q[j];            
                        tt.hp
            -=time*max(1,man[i].ati-tt.def);
                        tt.exp
            +=man[i].exp;
                        
            if(tt.exp>=100)
                        
            {
                            add
            =tt.exp/100;
                            tt.exp
            %=100;
                            tt.ati
            +=add*ati;
                            tt.def
            +=add*def;
                            tt.hp
            +=add*hp;
                            tt.lv
            +=add;
                        }

                        
            if(q[next].hp==0||tt.hp>q[next].hp||(q[next].hp==tt.hp&&(tt.lv*100+tt.exp)>(q[next].lv*100+q[next].exp)))
                        
            {
                            q[next]
            =tt;
                        }

                    }

                    q[j].hp
            =0;
                }

            }


            int main()
            {
                
            int i;
                
            char name[22];
                
            while(scanf("%d%d%d%d%d%d",&q[0].ati,&q[0].def,&q[0].hp,&ati,&def,&hp)>0)
                
            {
                    scanf(
            "%d",&n);
                    
            for(i=0;i<n;i++)
                        scanf(
            "%s%d%d%d%d",name,&man[i].ati,&man[i].def,&man[i].hp,&man[i].exp);
                    m
            =(1<<n)-1;
                    q[
            0].lv=1;
                    q[
            0].exp=0;
                    
            for(i=1;i<=m;i++)
                    
            {
                        q[i].hp
            =0;
                    }

                    dp();
                    
            if(q[m].hp>0)
                        printf(
            "%d\n",q[m].hp);
                    
            else
                        printf(
            "Poor LvBu,his period was gone.\n");
                }

                
            return 0;
            }


             

            posted on 2009-11-26 20:46 西風蕭瑟 閱讀(1463) 評論(0)  編輯 收藏 引用 所屬分類: 動態(tài)規(guī)劃
            欧美久久精品一级c片片| 精品久久人人爽天天玩人人妻| 久久频这里精品99香蕉久| 久久精品国产日本波多野结衣| 亚洲AV乱码久久精品蜜桃| 国产亚洲色婷婷久久99精品| 久久精品中文字幕一区| 日本久久久久亚洲中字幕| 99国内精品久久久久久久| 久久亚洲精品国产亚洲老地址| av国内精品久久久久影院| 综合久久久久久中文字幕亚洲国产国产综合一区首 | 欧美国产精品久久高清| 久久精品夜夜夜夜夜久久| 久久精品亚洲男人的天堂| 久久天天躁狠狠躁夜夜avapp| 国产高清美女一级a毛片久久w| 久久SE精品一区二区| 人人狠狠综合88综合久久| 久久久精品人妻一区二区三区蜜桃| 久久亚洲av无码精品浪潮| 青青草国产成人久久91网| 无码AV波多野结衣久久| 久久只这里是精品66| 久久久青草青青国产亚洲免观| 久久精品国产亚洲综合色| 久久久无码一区二区三区| 无码国内精品久久人妻| 久久狠狠爱亚洲综合影院 | 国内精品人妻无码久久久影院导航 | 亚洲va中文字幕无码久久不卡 | 日韩精品无码久久一区二区三| 国产精品无码久久综合| 久久青青草原精品国产| 人妻精品久久无码专区精东影业| 一本色道久久综合| 无码人妻久久一区二区三区蜜桃| 国内精品免费久久影院| 久久久久人妻一区精品| 久久综合久久性久99毛片| 中文字幕久久亚洲一区|