• <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>
            心如止水
            Je n'ai pas le temps
            posts - 400,comments - 130,trackbacks - 0
            簡單的遞推,d[i]=d[i-1]+d[i-1]+d[i-2]+d[i-3]。數據規模很大,需要使用高精度。
            以下是我的代碼:
            #include<iostream>
            #include
            <stdio.h>
            #include
            <string.h>
            #define maxn 1007
            #define maxl 90
            using namespace std;

            typedef 
            struct
            {
                
            long l,s[maxl];
            }bign;
            void Add(bign &c,bign &a,bign &b)
            {
                memset(
            &c,0,sizeof(c));
                c.l
            =(a.l>b.l?a.l:b.l);
                
            for(long i=0;i<c.l;i++)
                {
                   c.s[i]
            +=a.s[i]+b.s[i];
                   
            if(c.s[i]>=100000)
                   {
                      c.s[i]
            -=100000;
                      c.s[i
            +1]++;
                   }
                }
                
            if(c.s[c.l]) c.l++;
            }
            void Print(bign &a)
            {
                printf(
            "%ld",a.s[a.l-1]);
                
            for(long i=a.l-2;i>=0;i--)
                  printf(
            "%05ld",a.s[i]);
            }

            long n;
            bign d[maxn]
            ={{1,{1}},{1,{2}},{1,{5}},{1,{13}}};

            int main()
            {
                
            for(long i=4;i<=1000;i++)
                {
                   
            //  d[i]=d[i-1]+d[i-1]+d[i-2]+d[i-3]
                   bign t1,t2;
                   Add(t1,d[i
            -1],d[i-1]);
                   Add(t2,t1,d[i
            -2]);
                   Add(d[i],t2,d[i
            -3]);
                }
                
                
            while(cin>>n)
                {
                   Print(d[n]);
                   cout
            <<endl;
                }
            return 0;
            }
            posted on 2010-11-12 23:17 lee1r 閱讀(779) 評論(0)  編輯 收藏 引用 所屬分類: 題目分類:遞推/遞歸
            精品久久无码中文字幕| 99久久国产宗和精品1上映| 久久久国产精华液| 亚洲国产精品无码久久SM| 无夜精品久久久久久| 精品久久久久久中文字幕人妻最新| 中文字幕无码久久精品青草| 日韩人妻无码一区二区三区久久99 | 午夜精品久久久久久久| 久久久久久久久久久精品尤物 | 77777亚洲午夜久久多喷| 久久精品国产亚洲αv忘忧草| 日本高清无卡码一区二区久久| 久久99国产综合精品免费| 亚洲AV日韩精品久久久久| 久久精品国产亚洲AV忘忧草18| 人人狠狠综合88综合久久| 久久久精品人妻无码专区不卡| 99久久综合国产精品二区| 国产精品成人无码久久久久久| 久久国产乱子精品免费女| 久久精品国产亚洲一区二区三区| 91久久成人免费| 亚洲精品午夜国产va久久| 久久人妻AV中文字幕| 精品九九久久国内精品| 久久精品免费一区二区| 99国产精品久久| 久久精品18| 国产成人无码精品久久久性色 | 久久伊人色| 久久精品日日躁夜夜躁欧美 | 国产美女久久久| 久久久久国产一级毛片高清板| 香蕉久久影院| 国产精品福利一区二区久久| 国产精品欧美久久久久无广告 | 无码日韩人妻精品久久蜜桃| 久久中文字幕一区二区| 久久久久国产精品嫩草影院| 国产成人精品久久综合|