• <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  回復  更多評論
              
            久久99这里只有精品国产| 日本强好片久久久久久AAA | 无码国内精品久久人妻蜜桃| 少妇内射兰兰久久| 日韩AV毛片精品久久久| 久久综合给合久久狠狠狠97色 | 9191精品国产免费久久| 中文字幕无码免费久久| 97热久久免费频精品99| 狼狼综合久久久久综合网| 久久国产乱子伦精品免费午夜| 国产亚洲精品自在久久| 亚洲国产精品18久久久久久| 亚洲国产精品久久久久网站| 狠狠色婷婷久久一区二区三区| 亚洲精品乱码久久久久久| 亚洲综合熟女久久久30p| 国内精品伊人久久久影院| 欧美激情精品久久久久久久| 久久强奷乱码老熟女| 色综合久久88色综合天天| 久久久国产精华液| 久久精品国产99国产精品亚洲 | 久久久无码一区二区三区| A级毛片无码久久精品免费| 亚洲午夜无码AV毛片久久| 亚洲国产另类久久久精品| 久久久久四虎国产精品| 久久久久久青草大香综合精品| 久久免费视频1| 精品久久久久久无码人妻蜜桃 | 18禁黄久久久AAA片| 国产福利电影一区二区三区久久老子无码午夜伦不 | 久久99九九国产免费看小说| 精品久久久久成人码免费动漫| 中文字幕久久精品无码| 久久精品国产99久久香蕉| 久久美女网站免费| 久久er热视频在这里精品| 中文字幕热久久久久久久| 中文字幕无码久久久|