• <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>
            我叫張小黑
            張小黑的掙扎生活
            posts - 66,  comments - 109,  trackbacks - 0

             

             1#include<iostream>
             2using namespace std;
             3#define Max_N 100
             4#define Max 60
             5typedef struct bigint{
             6    int data[Max];
             7    int len;
             8    friend bigint operator+(bigint,bigint);
             9    friend bigint operator*(bigint,bigint);
            10    void operator=(const bigint&y){
            11        this->len=y.len;
            12        for(int i=0;i<y.len;i++)
            13            this->data[i]=y.data[i];
            14    }
            15}BIGINT;
            16BIGINT Trees[Max_N+1];
            17BIGINT operator+(BIGINT x,BIGINT y)
            18{
            19    BIGINT r;
            20    int rlen=x.len>y.len?x.len:y.len;
            21    int tmp,i,jinwei=0;
            22    for(i=0;i<rlen;i++){
            23        tmp=x.data[i]+y.data[i]+jinwei;
            24        r.data[i]=tmp%10;
            25        jinwei=tmp/10;}
            26    if(jinwei)r.data[rlen++]=jinwei;
            27    r.len=rlen;
            28    return r;
            29}
            30void print(BIGINT x)
            31{
            32    for(int i=x.len-1;i>=0;i--)
            33        printf("%d",x.data[i]);
            34    printf("\n");
            35}
            36BIGINT operator*(BIGINT x,BIGINT y)
            37{
            38    BIGINT r;
            39    int i,j;
            40    memset(r.data,0,sizeof(r.data));
            41    r.len=x.len+y.len;
            42    for(i=0;i<x.len;i++)
            43        for(j=0;j<y.len;j++)
            44            r.data[i+j]+=x.data[i]*y.data[j];
            45    for(i=0;i<r.len;i++){
            46        r.data[i+1]+=r.data[i]/10;
            47        r.data[i]%=10;}
            48    while(r.data[i]){
            49        r.data[i+1]+=r.data[i];
            50        r.data[i]%=10;
            51        i++;}
            52    while(i>=0&&!r.data[i])i--;
            53    r.len=i+1;
            54    return r;
            55}
            56void init()
            57{
            58    int i,j;
            59    memset(Trees,0,sizeof(Trees));
            60    Trees[0].data[0]=1;
            61    Trees[0].len=1;
            62    for(i=1;i<=Max_N;i++)
            63        for(j=0;j<i;j++)
            64            Trees[i]=Trees[i]+Trees[j]*Trees[i-j-1];
            65}
            66int main()
            67{
            68    int n;
            69    init();
            70    while(scanf("%d",&n)!=EOF)
            71        print(Trees[n]);
            72    return 0;
            73}
            posted on 2008-03-02 17:10 zoyi 閱讀(211) 評論(2)  編輯 收藏 引用 所屬分類: acm

            FeedBack:
            # re: ecnu 1850 高精度~~
            2008-03-05 19:06 | 張棚
            好模板...
            頂..
            借用了,呵呵。  回復  更多評論
              
            # re: ecnu 1850 高精度~~
            2008-03-06 21:36 | zoyi
            厄~~就是小強的摸版阿,我就是重載了運算符  回復  更多評論
              
            歡迎光臨 我的白菜菜園

            <2008年7月>
            293012345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789

            常用鏈接

            留言簿(8)

            隨筆分類

            隨筆檔案

            文章檔案

            相冊

            acmer

            online judge

            隊友

            技術

            朋友

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            久久99久久成人免费播放| 久久久这里只有精品加勒比| 亚洲色大成网站WWW久久九九| 中文字幕乱码人妻无码久久| 久久久久免费看成人影片| 久久婷婷久久一区二区三区| 亚洲精品无码久久久久AV麻豆| 麻豆亚洲AV永久无码精品久久| 99久久亚洲综合精品网站| 亚洲中文字幕久久精品无码APP| 久久免费高清视频| 少妇久久久久久久久久| 久久99精品国产麻豆不卡| 综合网日日天干夜夜久久| 亚洲欧美精品伊人久久| 蜜臀久久99精品久久久久久小说| 国产精品热久久毛片| 97久久综合精品久久久综合 | 怡红院日本一道日本久久| 久久亚洲中文字幕精品一区四| 久久人人爽人人爽人人AV东京热 | 久久国产免费直播| 久久国产精品无码HDAV| 久久久久久久波多野结衣高潮| 精品久久久久久无码人妻热| 国产精品视频久久久| 777午夜精品久久av蜜臀| 久久婷婷午色综合夜啪| 要久久爱在线免费观看| 久久人妻少妇嫩草AV无码蜜桃| 色综合久久综合网观看| 久久精品九九亚洲精品天堂| 国产一区二区三区久久| 久久99热精品| 94久久国产乱子伦精品免费| 国产精品岛国久久久久| 久久九九亚洲精品| 国产精品gz久久久| 久久国产精品免费一区| 亚洲国产成人久久综合区| 色诱久久av|