• <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
            需要注意兩點:1、前導0要刪除;2、a或者b溢出,c也不一定溢出,a或b為0的話結果為0。
            以下是我的代碼:
            #include <iostream>
            #include 
            <sstream>
            #include 
            <string>
            #include 
            <cstdio>
            using namespace std;
            typedef 
            long long int64;

            const string kInf = "2147483647";

            int cmp ( const string &a, const string &b )
            {
                
            if ( a.size() > b.size() )
                    
            return 1;
                
            else if ( a.size() < b.size() )
                    
            return -1;
                
            else
                {
                    
            for ( int i = 0; i < a.size(); i++ )
                        
            if ( a[i] > b[i] )
                            
            return 1;
                        
            else if ( a[i] < b[i] )
                            
            return -1;
                    
            return 0;
                }
            }

            int main ()
            {
            #ifndef ONLINE_JUDGE
                freopen ( 
            "data.in""r", stdin );
            #endif
                
                
            string a, t, b;
                
                
            while ( cin >> a >> t >> b )
                {
                    cout 
            << a << " " << t << " " << b << endl;
                    
            while ( a.size() > 1 && a[0== '0' )
                        a.erase ( 
            01 );
                    
            //cout << a << endl;
                    while ( b.size() > 1 && b[0== '0' )
                        b.erase ( 
            01 );
                    
            //cout << b << endl;
                    bool over = false;
                    
            if ( cmp ( a, kInf ) > 0 )
                    {
                        printf ( 
            "first number too big\n" );
                        over 
            = true;
                    }
                    
            if ( cmp ( b, kInf ) > 0 )
                    {
                        printf ( 
            "second number too big\n" );
                        over 
            = true;
                    }
                    
            if ( over )
                    {
                        
            if ( t == "+" || ( t == "*" && a != "0" && b != "0" ) ) 
                            printf ( 
            "result too big\n" );
                        
            continue;
                    }
                    int64 aa, bb, cc;
                    istringstream ( a ) 
            >> aa;
                    istringstream ( b ) 
            >> bb;
                    
            if ( t == "+" )
                        cc 
            = aa + bb;
                    
            else
                        cc 
            = aa * bb;
                    
            if ( cc > 0x7fffffff )
                        printf ( 
            "result too big\n" );
                }
                
                
            return 0;
            }
            posted on 2011-09-08 10:42 lee1r 閱讀(591) 評論(1)  編輯 收藏 引用 所屬分類: 題目分類:數學/數論

            FeedBack:
            # re: UVa 465 Overflow
            2012-01-12 20:16 | as
            DSFAS  回復  更多評論
              
            伊人久久免费视频| 伊人色综合久久天天人守人婷| 午夜不卡久久精品无码免费| 国产91色综合久久免费分享| 久久精品无码免费不卡| 99久久精品免费看国产一区二区三区| 久久精品无码专区免费东京热| 久久久久国色AV免费观看| 国产偷久久久精品专区| 99久久免费国产精品| 中文字幕久久精品无码| 亚洲精品国产成人99久久| 久久亚洲国产精品成人AV秋霞| 久久青草国产精品一区| 久久亚洲国产精品成人AV秋霞| 激情五月综合综合久久69| 国产产无码乱码精品久久鸭| 亚洲欧美成人久久综合中文网| 26uuu久久五月天| 一本色道久久88加勒比—综合| 亚洲AV无码久久精品狠狠爱浪潮| 人人狠狠综合久久亚洲高清| 伊人色综合久久天天| 91精品国产高清久久久久久国产嫩草| 亚洲va久久久噜噜噜久久| 中文字幕精品久久久久人妻| 国产视频久久| 老司机午夜网站国内精品久久久久久久久 | 四虎久久影院| 久久久精品视频免费观看 | 国产巨作麻豆欧美亚洲综合久久| 亚洲狠狠婷婷综合久久蜜芽| 久久精品一区二区三区AV| 亚洲伊人久久成综合人影院| 无码任你躁久久久久久久| 日韩美女18网站久久精品| 日韩欧美亚洲综合久久影院Ds| 久久综合九色综合久99| 久久亚洲精品无码VA大香大香| 一本色道久久HEZYO无码| 欧洲精品久久久av无码电影|