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

            FeedBack:
            # re: UVa 465 Overflow
            2012-01-12 20:16 | as
            DSFAS  回復  更多評論
              
            久久久久国产精品三级网| 日产久久强奸免费的看| 亚洲乱码日产精品a级毛片久久| 无码人妻久久一区二区三区免费丨| 国产一区二区精品久久凹凸 | 性欧美大战久久久久久久| 97久久超碰国产精品旧版| 久久久久久久久久久久中文字幕 | 久久精品国产亚洲AV无码娇色 | 精品久久久久久久久中文字幕| 久久精品成人欧美大片| 久久人人爽人人爽人人片AV东京热| 青青热久久国产久精品| 99久久免费国产精品特黄| 伊人色综合久久天天人守人婷 | 蜜桃麻豆www久久| 精品久久久久久无码中文野结衣| 久久精品中文字幕第23页| 四虎影视久久久免费观看| 久久久久亚洲AV无码专区首JN| 亚洲熟妇无码另类久久久| 久久99精品综合国产首页| 精品乱码久久久久久夜夜嗨| 思思久久好好热精品国产| 亚洲国产精品无码久久一区二区| 国产成人综合久久综合| 久久精品国产精品亚洲人人| 丁香色欲久久久久久综合网| 国产精品一久久香蕉国产线看 | 中文字幕久久精品| 久久精品aⅴ无码中文字字幕不卡 久久精品aⅴ无码中文字字幕重口 | 国内精品久久九九国产精品| 欧美久久一级内射wwwwww.| 日韩av无码久久精品免费| 国产激情久久久久影院老熟女免费| 久久综合九色综合久99| 久久久久久久久久免免费精品 | 久久精品这里只有精99品| 亚洲中文字幕无码久久精品1| 四虎国产精品免费久久久| 久久九九兔免费精品6|