• <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 閱讀(586) 評論(1)  編輯 收藏 引用 所屬分類: 題目分類:數學/數論

            FeedBack:
            # re: UVa 465 Overflow
            2012-01-12 20:16 | as
            DSFAS  回復  更多評論
              
            久久成人国产精品| 性高朝久久久久久久久久| 亚洲AV日韩AV永久无码久久| 久久www免费人成看片| 久久国产高潮流白浆免费观看| 国产精品18久久久久久vr| 国产精品亚洲美女久久久| 日本国产精品久久| 国产午夜免费高清久久影院| 久久久久久亚洲精品不卡 | 久久久精品久久久久影院| 99re这里只有精品热久久| 日产久久强奸免费的看| 国产91色综合久久免费分享| 一本大道久久东京热无码AV| 精品久久久无码人妻中文字幕豆芽| 国产成人精品久久| 嫩草伊人久久精品少妇AV| 久久夜色精品国产| 久久国产乱子伦精品免费强 | 久久久无码一区二区三区| 狠狠精品久久久无码中文字幕| 久久久久久久精品成人热色戒| 狠狠色丁香婷婷久久综合不卡| 一日本道伊人久久综合影| 国产成人综合久久精品尤物| 久久久久成人精品无码中文字幕| 亚洲国产成人久久综合野外| 热久久这里只有精品| 91精品国产高清久久久久久io | 精品综合久久久久久97超人| 亚洲va久久久噜噜噜久久| 久久九九久精品国产免费直播| 日韩精品无码久久一区二区三| 国内精品久久久久影院网站 | 久久久久亚洲AV片无码下载蜜桃| 久久精品中文字幕有码| 久久久久国产| 尹人香蕉久久99天天拍| 国产精品久久久久久久久久影院| 国产精品成人久久久|