亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? bignum.cpp

?? 處理大數(shù) 能夠處理負(fù)數(shù) 加減乘除優(yōu)先順序
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
        n *= 10;
        int dig = ( int )floor( n );
        n -= dig;
        if( !dig ) continue;

        int carry = 0;
        for( int j = 0; j < size || carry; j++ )
        {
            int newdig =
                ( i + j < 0 ? afterDot[-( i + j )] : result.digits[i + j] )
                + dig * digits[j]
                + carry;
            ( i + j < 0 ? afterDot[-( i + j )] : result.digits[i + j] ) = newdig % 10;
            if( i + j >= 0 && result.digits[i + j] ) result.size >?= i + j + 1;
            carry = newdig / 10;
        }
    }
    if( !result.size ) result.sign = 0;
    return result;
}

void BigInt::operator*=( long double n )
{
    operator=( operator*( n ) );
}

BigInt BigInt::operator<<( int n )
{
    BigInt result( *this );
    result <<= n;
    return result;
}

void BigInt::operator<<=( int n )
{
    if( n < 0 ) operator>>=( -n );
    else if( n > 0 )
    {
        BigInt mult( 1, 4 * n );
        for( int i = ( 1 << 30 ); i; i >>= 1 )
        {
            mult *= mult;
            if( n & i ) mult *= 2;
        }
        operator*=( mult );
    }
}

BigInt BigInt::operator>>( int n )
{
    BigInt result( *this );
    result >>= n;
    return result;
}

void BigInt::operator>>=( int n )
{
    if( n < 0 ) operator<<=( -n );
    else if( n > 0 )
    {
        BigInt mult( 1, 4 * n );
        for( int i = ( 1 << 30 ); i; i >>= 1 )
        {
            mult *= mult;
            if( n & i ) mult *= 2;
        }
        operator/=( mult );
    }
}
/*
BigInt BigInt::operator&( int n )
{
}

BigInt BigInt::operator&( BigInt n )
{
}

void BigInt::operator&=( int n )
{
}

void BigInt::operator&=( BigInt n )
{
}

BigInt BigInt::operator|( int n )
{
}

BigInt BigInt::operator|( BigInt n )
{
}

void BigInt::operator|=( int n )
{
}

void BigInt::operator|=( BigInt n )
{
}

BigInt BigInt::operator^( int n )
{
}

BigInt BigInt::operator^( BigInt n )
{
}

void BigInt::operator^=( int n )
{
}

void BigInt::operator^=( BigInt n )
{
}

BigInt BigInt::operator~()
{
}
*/
BigInt BigInt::operator,( int n )
{
    BigInt result( 0, size + ( int )sizeof( n ) * 8 );
    for( result.size = 0; n; result.size++ )
    {
        result.digits[result.size] = n % 10;
        n /= 10;
    }
    memcpy( result.digits + result.size, digits, size * sizeof( digits[0] ) );
    result.size += size;
    result.sign = 1;
    result.normalize();
    return result;
}

BigInt BigInt::operator,( BigInt n )
{
    BigInt result( 0, size + n.size );
    memcpy( result.digits, n.digits, n.size * sizeof( n.digits[0] ) );
    memcpy( result.digits + n.size, digits, size * sizeof( digits[0] ) );
    result.size = size + n.size;
    result.sign = 1;
    result.normalize();
    return result;
}

bool BigInt::operator!()
{
    return !size;
}

BigInt::operator bool()
{
    return size;
}

//BigInt::operator int()
//{
//    return toInt();
//}

BigInt::operator string()
{
    return toString();
}

bool BigInt::operator<( BigInt n )
{
    return( compare( n ) < 0 );
}

bool BigInt::operator>( BigInt n )
{
    return( compare( n ) > 0 );
}

bool BigInt::operator==( BigInt n )
{
    return( compare( n ) == 0 );
}

bool BigInt::operator<=( BigInt n )
{
    return( compare( n ) <= 0 );
}

bool BigInt::operator>=( BigInt n )
{
    return( compare( n ) >= 0 );
}

bool BigInt::operator<( int n )
{
    return( compare( BigInt( n ) ) < 0 );
}

bool BigInt::operator>( int n )
{
    return( compare( BigInt( n ) ) > 0 );
}

bool BigInt::operator==( int n )
{
    return( compare( BigInt( n ) ) == 0 );
}

bool BigInt::operator<=( int n )
{
    return( compare( BigInt( n ) ) <= 0 );
}

bool BigInt::operator>=( int n )
{
    return( compare( BigInt( n ) ) >= 0 );
}

int BigInt::compare( BigInt n )
{
    if( sign < n.sign ) return -1;
    if( sign > n.sign ) return 1;
    if( size < n.size ) return -sign;
    if( size > n.size ) return sign;
    for( int i = size - 1; i >= 0; i-- )
    {
        if( digits[i] < n.digits[i] ) return -sign;
        else if( digits[i] > n.digits[i] ) return sign;
    }
    return 0;
}

long double log2( BigInt x, long double epsilon = 0.000000000000001 )
{
    static /* const */ long double O = 0.0;
    if( x.sign <= 0 ) return O / O;     // Return NaN

    long double y = 0.0, z = 1.0, f = 0.0;
    while( x >= 2 )
    {
        if( x.divide( 2 ) ) f += 1.0;
        f /= 2.0;
        y++;
    }
    f += 1.0;
    while( z > epsilon )
    {
        f *= f;
        z /= 2.0;
        if( f >= 2.0 )
        {
            y += z;
            f /= 2.0;
        }
    }
    return y;
}

inline long double log( BigInt x, long double epsilon = 0.000000000000001 )
{
    return log2( x, epsilon ) * 0.6931471805599;
}

inline long double log10( BigInt x, long double epsilon = 0.000000000000001 )
{
    return log2( x, epsilon ) * 0.301029995664;
}

inline long double lg( BigInt x, long double epsilon = 0.000000000000001 )
{
    return log2( x, epsilon );
}

inline long double ln( BigInt x, long double epsilon = 0.000000000000001 )
{
    return log( x, epsilon );
}

/** DEBUG & TESTING **/
int main()
{
    cout << "Constructors and copy constructors:" << endl;
    cout << "12345000 = " << BigInt( 12345000 ) << endl;
    BigInt b = BigInt( 12345000 );
    cout << "12345000 = " << b << endl;
    BigInt c; c = b;
    cout << "12345000 = " << c << endl;
    cout << "1234567890 = " << BigInt( ( long double )1234567890.49999 ) << endl;
    cout << endl;

    cout << "Addition and subtraction:" << endl;
    cout << "123 + 234 = " << ( BigInt( 123 ) + 234 ).toInt() << endl;
    cout << "243 + 999 = " << ( BigInt( 243 ) + BigInt( 999 ) ) << endl;
    cout << "-123 + -321 = " << ( BigInt( -123 ) + BigInt( -321 ) ) << endl;
    cout << "-123 + 321 = " << ( BigInt( -123 ) + BigInt( 321 ) ) << endl;
    cout << "-2 + 5 = " << ( BigInt( -2 ) + 5 ) << endl;
    cout << "-2 + 5 = " << ( BigInt( -2 ) + BigInt( 5 ) ) << endl;
    cout << "-2 + -5 = " << ( BigInt( -2 ) + -5 ) << endl;
    cout << "-2 + -5 = " << ( BigInt( -2 ) + BigInt( -5 ) ) << endl;
    cout << "0 + -5 = " << ( BigInt( 0 ) + -5 ) << endl;
    cout << "0 + -5 = " << ( BigInt( 0 ) + BigInt( -5 ) ) << endl;
    cout << "4567 - 1234 = " << ( 4567 - BigInt( 1234 ) ) << endl;
    cout << "345 - 46 = " << ( BigInt( 345 ) - BigInt( 46 ) ) << endl;
    cout << "2 - 6 = " << ( BigInt( 2 ) - BigInt( 6 ) ) << endl;
    cout << "2 - 6 = " << ( BigInt( 2 ) - 6 ) << endl;
    cout << "0 - 5 = " << ( BigInt( 0 ) - 5 ) << endl;
    cout << "0 - 5 = " << ( BigInt( 0 ) - BigInt( 5 ) ) << endl;
    cout << "0 - -5 = " << ( BigInt( 0 ) - -5 ) << endl;
    cout << "0 - -5 = " << ( BigInt( 0 ) - BigInt( -5 ) ) << endl;
    cout << "10000 - 10000 = " << ( BigInt( 10000 ) - 10000 ) << endl;
    cout << "10000 - 10110 = " << ( BigInt( 10000 ) - 10110 ) << endl;
    cout << "4567 - 4568 = " << ( BigInt( 4567 ) - 4568 ) << endl;
    cout << "-4567 - -4568 = " << ( BigInt( -4567 ) - BigInt( -4568 ) ) << endl;
    cout << "999 - 9999 = " << ( BigInt( 999 ) - 9999 ) << endl;
    cout << "2000000000 + 2000000000 + 2000123456 = " << ( BigInt( 2000000000 ) + 2000000000 + BigInt( 2000123456 ) ) << endl;
    cout << "-34567 + 34568 = " << ( BigInt( -34567 ) + BigInt( 34568 ) ) << endl;
    cout << "10 - 1 = " << ( BigInt( 10 ) - 1 ) << endl;
    cout << "1 - 10 = " << ( BigInt( 1 ) - 10 ) << endl;
    cout << "Fib( 613 ) + Fib( 614 ) = " << (
        BigInt( "57535841731394367586444934959935162731893485882113791734636043664022186311322175066312007025864665068095897804714985049873571833" )
        +
        BigInt( "93094947492730684688120544687306111880728698574224279139760379700550384193434187688727692133714165658764281830930007773906603177" )
        ) << endl;
    cout << endl;
    cout << "Multiplication/division:" << endl;
    cout << "128 * 512 = " << ( BigInt( 128 ) * 512 ) << endl;
    cout << "0 * 12345 = " << ( BigInt( 0 ) * 12345 ) << endl;
    cout << "-123 * 0 = " << ( BigInt( -123 ) * 0 ) << endl;
    cout << "-12345 * 1000001 = " << ( BigInt( -12345 ) * BigInt( 1000001 ) ) << endl;
    cout << "-1 * -1 = " << ( BigInt( -1 ) * BigInt( -1 ) ) << endl;
    cout << "1024 / 2 = " << ( BigInt( 1024 ) / 2 ) << endl;
    cout << "-525474 / -789 = " << ( BigInt( -525474 ) / -789 ) << endl;
    cout << "-81 / 27 = " << ( BigInt( -81 ) / 27 ) << endl;
    cout << "0 / -888 = " << ( BigInt( 0 ) / -888 ) << endl;
    cout << "1024 / 2 = " << ( BigInt( 1024 ) / BigInt( 2 ) ) << endl;
    cout << "-525474 / -789 = " << ( BigInt( -525474 ) / BigInt( -789 ) ) << endl;
    cout << "-81 / 27 = " << ( BigInt( -81 ) / BigInt( 27 ) ) << endl;
    cout << "0 / -888 = " << ( BigInt( 0 ) / BigInt( -888 ) ) << endl;
    BigInt q = 1023;
    int rem = q.divide( 2 );
    cout << "1023 / 2 = " << q << " + " << rem << "/2" << endl;
    q = 1219255159;
    rem = q.divide( 98765 );
    cout << "1219255159 / 98765 = " << q << " + " << rem << "/98765" << endl;
    q = 121;
    rem = q.divide( 11 );
    cout << "121 / 11 = " << q << " + " << rem << "/11" << endl;
    q = 1023;
    BigInt rem2 = q.divide( BigInt( 2 ) );
    cout << "1023 / 2 = " << q << " + " << rem2 << "/2" << endl;
    q = 1219255159;
    rem2 = q.divide( BigInt( 98765 ) );
    cout << "1219255159 / 98765 = " << q << " + " << rem2 << "/98765" << endl;
    q = 121;
    rem2 = q.divide( BigInt( 11 ) );
    cout << "121 / 11 = " << q << " + " << rem2 << "/11" << endl;
    q = 9999;
    rem2 = q.divide( BigInt( 9 ) );
    cout << "9999 / 9 = " << q << " + " << rem2 << "/9" << endl;
    cout << "1024 * 15.37 = " << BigInt( 1024 ) * 15.37l << endl;
    cout << "100 * 0.5 = " << BigInt( 100 ) * 0.5l << endl;
    cout << "123456789 * 0.123456789 = " << BigInt( 123456789 ) * 0.123456789l << endl;
    cout << "4286 * -0.5 = " << BigInt( 4286 ) * -0.5l << endl;
    cout << "29384723 * 1.0 = " << BigInt( 29384723 ) * 1.0l << endl;
    cout << "29384723 * -1.0 = " << BigInt( 29384723 ) * -1.0l << endl;
    cout << "3874928345 * 0.0 = " << BigInt( "3874928345" ) * 0.0l << endl;
    BigInt n = 1000;
    cout << "n = 1000: n*n*(8+n*(12+n*(3+n*n))) = " << n*n*(8+n*(12+n*(3+n*n))) << endl;
    
    cout << endl;
    cout << "Concatenation:" << endl;
    cout << "123,456 = " << ( BigInt( 123 ), 456 ) << endl;
    cout << "9999,55 = " << ( BigInt( 9999 ), BigInt( 55 ) ) << endl;
    cout << "0,1 = " << ( BigInt( 0 ), BigInt( 1 ) ) << endl;
    cout << "0,0 = " << ( BigInt( 0 ), 0 ) << endl;
    cout << "0,0 = " << ( BigInt( 0 ), BigInt( 0 ) ) << endl;
    cout << endl;
    cout << "Reflection:" << endl;
    BigInt x = 11;
    cout << "11 + 11 = " << ( x + x ) << endl;
    cout << "11 * 11 = " << ( x * x ) << endl;
    x += x;
    cout << "11 + 11 = " << x << endl;
    x *= x;
    cout << "22 * 22 = " << x << endl;
    cout << endl;
    cout << "Bitwise operations:" << endl;
    cout << "1 << 10 = " << ( 1 << 10 ) << " = " << ( BigInt( 1 ) << 10 ) << endl;
    cout << "-7 << 2 = " << ( -7 << 2 ) << " = " << ( BigInt( -7 ) << 2 ) << endl;
    cout << "3 << 8 = " << ( 3 << 8 ) << " = " << ( BigInt( 3 ) << 8 ) << endl;
    cout << "3 << 9 = " << ( 3 << 9 ) << " = " << ( BigInt( 3 ) << 9 ) << endl;
    cout << "1024 >> 9 = " << ( 1024 >> 9 ) << " = " << ( BigInt( 1024 ) >> 9 ) << endl;
    cout << "-1 >> 4 = " << (-1 >> 4) << " = " << ( BigInt( -1 ) >> 4 ) << endl;
    cout << endl;
    cout << "Input:" << endl;
    istringstream in( "1234567890" );
    in >> x;
    cout << "1234567890 = " << x << endl;
    istringstream in2( " \t\n\r01234 -00009876\t" );
    in2 >> x >> rem2;
    cout << "1234 = " << x << endl;
    cout << "-9876 = " << rem2 << endl;
    cout << endl;
    cout << "Exhaustion:" << endl;
    BigInt *table = new BigInt[10240];
    table[0] = 0; table[1] = 1;
    for( int i = 2; i < 10240; i++ )
        table[i] = table[i - 1] + table[i - 2];
    cout << "Fibonacci( 615 )  = " << table[615] << endl;
    cout << "Fibonacci( 10000 )  = " << table[10000] << endl;
    delete [] table;
    cout << endl;
    cout << "Logarithms" << endl;
    cout << "log2( 1024 ) = " << log2( BigInt( 1024 ) ) << endl;
    cout << "log2( 6 ) = " << log2( BigInt( 6 ) ) << endl;
    cout << "log( 0 ) = " << log( BigInt( 0 ) ) << endl;
    cout << "log10( 1000000 ) = " << log10( BigInt( 10000000 ) ) << endl;
    cout << "log( 1234567 ) = " << log( BigInt( 1234567 ) ) << endl;
    return 0;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲va在线va天堂| 色婷婷综合久久久| 国产精品第五页| 欧美精品国产精品| 99久免费精品视频在线观看| 日本欧洲一区二区| 亚洲精品国产一区二区精华液| 欧美一区二区黄| 欧美在线一区二区| 成人h精品动漫一区二区三区| 美女视频黄a大片欧美| 亚洲靠逼com| 中文字幕av一区 二区| 日韩欧美电影在线| 欧美午夜免费电影| 色综合久久综合网欧美综合网| 激情另类小说区图片区视频区| 亚洲午夜免费电影| 亚洲视频免费看| 国产日韩欧美制服另类| 欧美mv日韩mv| 7777女厕盗摄久久久| 在线看不卡av| 97se亚洲国产综合自在线观| 国产精品白丝av| 久久av中文字幕片| 奇米精品一区二区三区四区| 天涯成人国产亚洲精品一区av| 亚洲精品中文在线观看| 亚洲色图色小说| 亚洲图片欧美激情| 国产精品你懂的在线欣赏| 久久久亚洲精品一区二区三区| 日韩免费在线观看| 日韩欧美视频一区| 日韩一区二区免费高清| 91精品国产一区二区三区香蕉 | 97se亚洲国产综合自在线不卡| 精品制服美女丁香| 麻豆91在线看| 国产亚洲成aⅴ人片在线观看| 欧美视频日韩视频在线观看| 一本大道av伊人久久综合| 波多野结衣一区二区三区| 国产99久久久久| 高清不卡一二三区| 最新久久zyz资源站| 国产福利精品导航| 国产aⅴ综合色| av不卡免费在线观看| 不卡av在线网| 色综合久久久久| 在线观看不卡视频| 欧美久久久一区| 日韩美一区二区三区| xfplay精品久久| 国产喷白浆一区二区三区| 国产精品女主播av| 亚洲精品乱码久久久久久黑人| 亚洲福利视频导航| 久久精品国产精品亚洲综合| 国产主播一区二区| 9久草视频在线视频精品| 在线观看亚洲一区| 日韩三级.com| 国产精品视频在线看| 亚洲精品视频免费看| 欧美激情一区二区三区| 最新欧美精品一区二区三区| 亚洲综合在线第一页| 免费一级片91| 高清在线观看日韩| 色狠狠综合天天综合综合| 91精品欧美久久久久久动漫 | 亚洲影视在线观看| 秋霞av亚洲一区二区三| 国产精品一区二区在线播放| 97精品久久久久中文字幕| 91超碰这里只有精品国产| 久久久蜜臀国产一区二区| 中文字幕欧美一| 日韩精品成人一区二区在线| 国产麻豆精品视频| 色88888久久久久久影院野外| 日韩欧美一级片| 亚洲男人天堂av网| 久久99国内精品| 在线精品国精品国产尤物884a| 精品日本一线二线三线不卡| 国产精品久久久久精k8| 日韩福利视频网| 99精品欧美一区| 精品入口麻豆88视频| 亚洲精品中文在线| 国产很黄免费观看久久| 欧美日韩国产综合一区二区| 久久精品人人爽人人爽| 天天av天天翘天天综合网| 成人短视频下载| 精品福利二区三区| 亚洲高清三级视频| a级高清视频欧美日韩| 日韩精品在线网站| 亚洲成人黄色小说| 91猫先生在线| 国产片一区二区三区| 六月丁香婷婷久久| 欧美日韩成人一区二区| 国产精品久久看| 国产综合色在线视频区| 91精品在线免费| 一区二区三区av电影| 成人av网站大全| 久久亚洲免费视频| 欧美日韩国产综合久久 | 亚洲视频香蕉人妖| 国产98色在线|日韩| 精品免费国产一区二区三区四区| 亚洲综合色丁香婷婷六月图片| 波多野洁衣一区| 久久精子c满五个校花| 精品一区二区免费视频| 欧美一区二区福利视频| 午夜免费久久看| 在线日韩av片| 亚洲激情在线播放| 91丨porny丨首页| 亚洲欧美综合网| 成人av综合一区| 国产精品嫩草99a| 成人午夜精品一区二区三区| 久久影音资源网| 国产福利一区二区三区视频在线| 日韩欧美高清在线| 精品一区二区久久| 久久久亚洲高清| 国产成人在线视频网址| 国产欧美一区二区精品婷婷| 国产精品99久久久久久似苏梦涵 | 亚洲成a人片在线不卡一二三区 | www国产成人免费观看视频 深夜成人网| 亚洲超碰97人人做人人爱| 欧美日韩卡一卡二| 偷拍与自拍一区| 欧美一区二区三区不卡| 麻豆精品在线视频| 久久亚洲免费视频| 丁香一区二区三区| 国产精品久久看| 色综合天天在线| 亚洲电影一区二区| 日韩一区二区三区电影在线观看| 九九视频精品免费| 日本一区免费视频| 色婷婷精品大视频在线蜜桃视频| 亚洲精品欧美激情| 欧美精品一卡二卡| 国内精品国产成人| 国产精品久久一卡二卡| 日本乱码高清不卡字幕| 奇米777欧美一区二区| 久久久久久久综合狠狠综合| av电影天堂一区二区在线观看| 亚洲精品免费电影| 日韩午夜av电影| 国产成人免费视频网站高清观看视频| 国产精品久久久久久一区二区三区| 91亚洲精品久久久蜜桃网站| 秋霞av亚洲一区二区三| 色噜噜偷拍精品综合在线| 天天av天天翘天天综合网| 久久久国产精华| 色综合久久中文综合久久97| 中文字幕字幕中文在线中不卡视频| 欧美日韩免费在线视频| 精品一区二区三区久久| 亚洲天堂2014| 欧美大片日本大片免费观看| 高清不卡在线观看| 亚洲国产cao| 日本一区二区三区视频视频| 欧美性猛片xxxx免费看久爱| 国产一区激情在线| 亚洲一区二区在线播放相泽| 久久尤物电影视频在线观看| 91搞黄在线观看| 国产精品一区在线观看你懂的| 一区二区三区免费网站| 久久久青草青青国产亚洲免观| 欧美在线观看18| 成人一区二区三区中文字幕| 日韩国产欧美在线播放| 国产精品国产精品国产专区不片| 91精品国产一区二区三区| 97久久超碰国产精品| 久久99久国产精品黄毛片色诱| 亚洲激情欧美激情| 中文字幕第一区| 欧美xxxxx牲另类人与| 欧美色大人视频|