• <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
            壓4位。
            以下是我的代碼:
            #include<stdio.h>
            #include
            <string.h>
            #define maxlen 10010
            typedef unsigned 
            long Long;
            typedef 
            struct
            {
                Long len,s[
            10000];
            }
            high;
            char s1[maxlen],s2[maxlen];
            high a,b,c;
            Long num(
            char s[],Long begin,Long end)
            {
                
            long i,re=0;
                i
            =begin;
                
            while(i<end)
                
            {
                   re
            +=s[i]-'0';
                   re
            *=10;
                   i
            ++;
                }

                re
            +=s[end]-'0';
                
            return re;
            }

            void init()
            {
                
            long i,l1,l2;
                a.len
            =0;
                b.len
            =0;
                c.len
            =0;
                
            for(i=0;i<10000;i++)
                
            {
                   a.s[i]
            =0;
                   b.s[i]
            =0;
                   c.s[i]
            =0;
                }

                scanf(
            "%s%s",s1,s2);
                l1
            =strlen(s1)-1;
                l2
            =strlen(s2)-1;
                
            for(i=l1;i>=0;i-=4)
                
            {
                   a.s[a.len]
            =num(s1,(i-3>0?i-3:0),i);
                   a.len
            ++;
                }

                
            for(i=l2;i>=0;i-=4)
                
            {
                   b.s[b.len]
            =num(s2,(i-3>0?i-3:0),i);
                   b.len
            ++;
                }

            }

            void mul()
            {
                
            long i,j;
                
            for(i=0;i<a.len;i++)
                  
            for(j=0;j<b.len;j++)
                  
            {
                     c.s[i
            +j]+=a.s[i]*b.s[j];
                     
            if(c.s[i+j]>=10000)
                     
            {
                        c.s[i
            +j+1]+=c.s[i+j]/10000;
                        c.s[i
            +j]%=10000;
                     }

                  }

                
            for(i=a.len+b.len;i>=0;i--)
                  
            if(c.s[i]!=0)
                    
            break;
                c.len
            =i+1;
            }

            void write()
            {
                
            long i;
                printf(
            "%ld",c.s[c.len-1]);
                
            for(i=c.len-2;i>=0;i--)
                
            {
                   
            if(c.s[i]<1000) printf("0");
                   
            if(c.s[i]<100) printf("0");
                   
            if(c.s[i]<10)   printf("0");
                   printf(
            "%ld",c.s[i]);
                }

                putchar(
            '\n');
            }

            int main()
            {
                init();
                mul();
                write();
            return 0;
            }

            posted on 2010-01-06 19:59 lee1r 閱讀(338) 評論(1)  編輯 收藏 引用 所屬分類: 題目分類:基礎/模擬

            FeedBack:
            # re: vijos P1040 高精度乘法
            2012-12-06 01:10 | 啦啦啦
            愛死你了  回復  更多評論
              
            国内精品久久国产大陆| 国产日韩久久久精品影院首页| 亚洲欧美国产精品专区久久 | 国产精品久久久香蕉| 一本色道久久99一综合| 国产精品久久99| 亚洲国产天堂久久综合| 久久久久亚洲AV无码麻豆| 99久久精品国产一区二区蜜芽| 伊人久久无码精品中文字幕| 久久国产精品久久久| 波多野结衣久久精品| 国产一区二区精品久久岳| 久久亚洲欧美国产精品| 青草久久久国产线免观| 久久精品国产91久久综合麻豆自制| 亚洲国产精品综合久久一线| 久久精品国产亚洲麻豆| 久久久久亚洲av无码专区喷水| 亚洲日韩欧美一区久久久久我| 91久久香蕉国产熟女线看| 久久久精品2019免费观看 | 7777精品久久久大香线蕉 | 久久国产亚洲精品麻豆| 老色鬼久久亚洲AV综合| 尹人香蕉久久99天天拍| 久久国产免费| 国产亚洲美女精品久久久| 久久香蕉国产线看观看乱码| AV色综合久久天堂AV色综合在| 中文字幕乱码久久午夜| 武侠古典久久婷婷狼人伊人| 久久精品夜色噜噜亚洲A∨| 99久久伊人精品综合观看| 91精品久久久久久无码| 婷婷综合久久狠狠色99h| 久久青青草原精品影院| 日本精品久久久中文字幕| 99久久国产主播综合精品| 精品国产乱码久久久久久浪潮| 狠狠精品久久久无码中文字幕|