• <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>
            隨筆 - 87  文章 - 279  trackbacks - 0
            <2025年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            潛心看書研究!

            常用鏈接

            留言簿(19)

            隨筆分類(81)

            文章分類(89)

            相冊

            ACM OJ

            My friends

            搜索

            •  

            積分與排名

            • 積分 - 216652
            • 排名 - 117

            最新評論

            閱讀排行榜

            評論排行榜

            #include? < iostream >
            #include?
            < string >
            using ? namespace ?std;

            typedef??
            long ? long ?_BigInt;
            const ? int ?BITSIZE? = ? 7000 ;
            const ? int ?EACHBITNUM? = ? 1000000000 ;
            class ?BIGINT
            {
            public :
            ????_BigInt?size;
            ????_BigInt?data[BITSIZE];
            ????BIGINT();
            ????BIGINT(
            string );
            ????BIGINT?
            operator = ( const ?BIGINT & );
            ????
            bool ? operator < ( const ?BIGINT? & );
            ????
            bool ? operator == ( const ?BIGINT? & );
            ????
            bool ? operator > ( const ?BIGINT? & );
            ????
            bool ? operator <= ( const ?BIGINT? & );
            ????
            bool ? operator >= ( const ?BIGINT? & );
            ????
            bool ? operator != ( const ?BIGINT? & );
            ????friend?BIGINT?
            operator + ( const ?BIGINT & ,? const ?BIGINT & );
            ????friend?BIGINT?
            operator - (BIGINT,?BIGINT);
            ????friend?BIGINT?
            operator * ( const ?BIGINT? & ,? const ?BIGINT? & );
            ????
            // friend?BIGINT?operator/(const?BIGINT?&,?const?BIGINT?&);
            ???? void ?print();
            }
            ;

            BIGINT::BIGINT()
            {
            ????size?
            = ? 0 ;
            ????memset(data,?
            0 ,? sizeof (data));
            }

            BIGINT::BIGINT(
            string ?s)
            {
            ????
            int ?i;
            ????
            int ?len? = ?s.length();
            ????
            int ?exp? = ? 1 ;
            ????_BigInt?tmp?
            = ? 0 ;
            ????size?
            = ? 0 ;
            ????memset(data,?
            0 ,? sizeof (data));
            ????
            for ?(i = len;?i >= 1 ;?i -- )
            ????
            {
            ????????tmp?
            += ?(s[i - 1 ]? - ? ' 0 ' )? * ?exp;
            ????????
            if ?(exp? == ?EACHBITNUM / 10 )
            ????????
            {????
            ????????????data[
            ++ size]? = ?tmp;
            ????????????tmp?
            = ? 0 ;
            ????????????exp?
            = ? 1 ;
            ????????}

            ????????
            else
            ????????????exp?
            *= ? 10 ;
            ????}

            ????
            if ?(tmp? != ? 0 )
            ????????data[
            ++ size]? = ?tmp;
            }

            BIGINT?BIGINT::
            operator = ( const ?BIGINT? & a)
            {
            ????
            int ?i;
            ????memset(data,?
            0 ,? sizeof (data));
            ????size?
            = ?a.size;
            ????
            for ?(i = 1 ;?i <= size;?i ++ )
            ????????data[i]?
            = ?a.data[i];
            ????
            return ? * this ;
            }

            void ?BIGINT::print()
            {
            ????
            int ?i;
            ????
            for ?(i = size;?i >= 1 ;?i -- )
            ????????
            if ?(i? != ?size)
            ???????????printf(
            " %.9lld " ,?data[i]);
            ????????
            else
            ???????????printf(
            " %lld " ,?data[i]);
            ????printf(
            " \n " );
            }

            bool ?BIGINT:: operator < ( const ?BIGINT? & a)
            {
            ?????
            int ?i;
            ?????
            if ?(size? < ?a.size)? return ? true ;
            ?????
            if ?(size? > ?a.size)? return ? false ;
            ?????
            for ?(i = 1 ;?i <= size;?i ++ )
            ?????????
            if ?(data[i]? >= ?a.data[i])? return ? false ;
            ?????
            return ? true ;?????
            }

            bool ?BIGINT:: operator == ( const ?BIGINT? & a)
            {
            ?????
            int ?i;
            ?????
            if ?(size? != ?a.size)? return ? false ;
            ?????
            for ?(i = 1 ;?i <= size;?i ++ )
            ?????????
            if ?(data[i]? != ?a.data[i])? return ? false ;
            ?????
            return ? true ;
            }

            bool ?BIGINT:: operator > ( const ?BIGINT? & a)
            {
            ?????
            int ?i;
            ?????
            if ?(size? > ?a.size)? return ? true ;
            ?????
            if ?(size? < ?a.size)? return ? false ;
            ?????
            for ?(i = 1 ;?i <= size;?i ++ )
            ?????????
            if ?(data[i]? <= ?a.data[i])? return ? false ;
            ?????
            return ? true ;??
            }

            bool ?BIGINT:: operator >= ( const ?BIGINT? & a)
            {
            ?????
            return ? ! (( * this )? < ?a);
            }

            bool ?BIGINT:: operator <= ( const ?BIGINT? & a)
            {
            ?????
            return ? ! (( * this )? > ?a);
            }

            bool ?BIGINT:: operator != ( const ?BIGINT? & a)
            {
            ?????
            return ? ! (( * this )? == ?a);
            }

            BIGINT?
            operator + ( const ?BIGINT? & a,? const ?BIGINT? & b)
            {
            ????BIGINT?rnt;
            ????
            int ?i;
            ????
            bool ?t? = ? false ;
            ????_BigInt?tmp;
            ????
            int ?len? = ?a.size? > ?b.size? ? ?a.size?:?b.size;
            ????
            for ?(i = 1 ;?i <= len;?i ++ )
            ????
            {
            ????????tmp?
            = ?a.data[i]? + ?b.data[i];
            ????????
            if ?(t)?tmp? += ? 1 ;
            ????????t?
            = ? false ;
            ????????
            if ?(tmp? >= ?EACHBITNUM)
            ????????
            {
            ????????????tmp?
            -= ?EACHBITNUM;
            ????????????t?
            = ? true ;
            ????????}

            ????????rnt.data[
            ++ rnt.size]? = ?tmp;
            ????}

            ????
            if ?(t)?rnt.data[ ++ rnt.size]? += ? 1 ;?
            ????
            return ?rnt;
            }

            BIGINT?
            operator - (BIGINT?a,?BIGINT?b)
            {
            ????BIGINT?rnt;
            ????
            int ?i;
            ??????
            // ?if?(a?<?b)?return?rnt;
            ???? for ?(i = 1 ;?i <= a.size;?i ++ )
            ????
            {
            ????????
            if ?(a.data[i]? < ?b.data[i])
            ????????
            {
            ????????????a.data[i
            + 1 ] -- ;
            ????????????a.data[i]?
            += ?EACHBITNUM;
            ????????}

            ????????rnt.data[
            ++ rnt.size]? = ?a.data[i]? - ?b.data[i];
            ????}

            ????
            return ?rnt;
            }

            BIGINT?
            operator * ( const ?BIGINT? & a,? const ?BIGINT? & b)
            {
            ????
            int ?i,?j;
            ????BIGINT?rnt;
            ????_BigInt?tmp;
            ????
            for ?(i = 1 ;?i <= a.size;?i ++ )
            ????????
            for ?(j = 1 ;?j <= b.size;?j ++ )
            ????????
            {
            ????????????tmp?
            = ?a.data[i]? * ?b.data[j];
            ????????????rnt.data[i
            + j - 1 ]? += ?tmp;
            ????????????rnt.data[i
            + j]? += ??rnt.data[i + j - 1 ]? / ?EACHBITNUM;
            ????????????rnt.data[i
            + j - 1 ]? %= ?EACHBITNUM;
            ????????}

            ????
            for ?(i = BITSIZE - 1 ;?i >= 1 ;?i -- )
            ????????
            if ?(rnt.data[i]? > ? 0 ? || ?i? == ? 1 )
            ????????
            {
            ????????????rnt.size?
            = ?i;
            ????????????
            break ;
            ????????}

            ????
            return ?rnt;
            }


            int ?main()
            {????
            ????
            int ?n;
            ????
            int ?i;
            ????BIGINT?one(
            " 1 " );
            ????BIGINT?y(
            " 1 " );
            ????cin?
            >> ?n;

            ????
            for ?(i = 1 ;?i <= n;?i ++ )
            ????
            {
            ????????y?
            = ?y? + ?one;
            ????????y.print();
            ????????y?
            = ?y? * ?(y? - ?one);
            ????}

            ????system(
            " pause " );
            ????
            return ? 0 ;
            }

            posted on 2006-09-03 04:29 閱讀(535) 評論(0)  編輯 收藏 引用 所屬分類: 數據結構與算法
            久久精品免费一区二区| 久久最新精品国产| 97精品伊人久久久大香线蕉 | 久久亚洲私人国产精品vA| 国产毛片欧美毛片久久久| 久久久精品人妻一区二区三区蜜桃| 无码人妻久久久一区二区三区 | 欧洲精品久久久av无码电影 | 国产精品无码久久久久久| 一本大道久久a久久精品综合| 久久免费视频1| 国产69精品久久久久9999| 国产69精品久久久久9999APGF| 伊人久久综合热线大杳蕉下载| 思思久久精品在热线热| 久久综合综合久久97色| 久久精品无码专区免费东京热| 久久久久国色AV免费观看| 久久国产亚洲高清观看| 无码人妻久久一区二区三区蜜桃| 2021少妇久久久久久久久久| 久久精品免费一区二区| 久久人人爽人爽人人爽av| 91久久九九无码成人网站| 久久99精品国产自在现线小黄鸭 | 无码AV中文字幕久久专区| 青青热久久国产久精品| 午夜不卡888久久| 日本三级久久网| 精品国产VA久久久久久久冰| 久久人人爽人人人人爽AV | 久久精品国产一区| 久久综合香蕉国产蜜臀AV| 国产A三级久久精品| 东方aⅴ免费观看久久av| 久久婷婷五月综合国产尤物app | AV色综合久久天堂AV色综合在 | 日韩人妻无码精品久久久不卡| 久久亚洲熟女cc98cm| 久久精品中文字幕一区| 久久人与动人物a级毛片|