_BIG_INT_ #include <iostream> #include <> #include <.h> #include <cassert> #include <sys/types.h> int64_t SIZE = big_int():len(), positive(){ memset(array, , SIZE*()); } big_int( *a, big_int( *ch, big_int( std::& big_int ( ~ big_int( big_int& big_int& = ( big_int& big_int& += ( big_int& big_int& -= ( big_int& big_int& *= ( big_int& big_int - big_int& ++ (); big_int ++ ( big_int& -- (); big_int -- ( inline length() inline is_positive() big_int abs() friend std::ostream& << (std::ostream& os, big_int& friend == ( big_int& lbi, big_int& friend != ( big_int& lbi, big_int& friend < ( big_int& lbi, big_int& friend big_int + ( big_int& lbi, big_int& friend big_int - ( big_int& lbi, big_int& friend big_int * ( big_int& lbi, big_int& std::ostream& << (std::ostream& os, big_int& == ( big_int& lbi, big_int& != ( big_int& lbi, big_int& < ( big_int& lbi, big_int& big_int + ( big_int& lbi, big_int& big_int - ( big_int& lbi, big_int& big_int * ( big_int& lbi, big_int& big_int::is_positive() big_int::length()
#include num = ( i = SIZE-; i != -; -- (array[i] != ++ (SIZE - num) == ? : (SIZE - big_int::big_int( std::& memset(array, , SIZE*( (str[] == positive = positive = len = positive ? str.size() : str.size()- j = positive ? : end = j- ( i = str.size()-, k = len-; i != end; --i, ++j, -- array[k] = str[j] - big_int::big_int( *a, memset(array, , SIZE*( assert(a != (a[] < positive = positive = len = array[len-] = positive ? a[] : -a[ ( i = len-, j = ; i != -; --i, ++ array[i] = big_int::big_int( *ch, memset(array, , SIZE*( assert(ch != (ch[] == positive = positive = len = positive ? l : l- j = positive ? : end = j- ( i = l-, k = len-; i != end; --i, ++j, -- array[k] = ch[j] - big_int::big_int( big_int& memcpy(array, b.array, SIZE*( len = positive = big_int::big_int( memset(array, , SIZE*( int64_t t = (t < positive = t = - positive = l = , i = (t == array[] = len = { array[i] = t % t /= ++ ++ len = big_int& big_int:: = ( big_int& (* == * memcpy(array, b.array, SIZE*( len = positive = * big_int& big_int:: += ( big_int& (positive == bi.positive) tmpi = end = len >= bi.len ? ( i = ; i != end+; ++ tmpi += array[i] + array[i] = tmpi % tmpi /= (->abs() == * = (->abs() < ( i = ; i != tmp.len; ++ (array[i] > tmp.array[i]+=, --tmp.array[i+ array[i] = tmp.array[i] - positive = ( i = ; i != len; ++ (bi.array[i] > array[i]+=, --array[i+ array[i] = array[i] - len = * big_int& big_int:: -= ( big_int& * += - big_int& big_int:: *= ( big_int& x = memset(array_tmp, , SIZE*( (bi == big_int( positive = * = big_int( (len <= ( i = ; i != len; ++ ( j = i, k = ; k != bi.len; ++j, ++ x = array[i] * array_tmp[j] += (array_tmp[j] >= array_tmp[j+] += array_tmp[j] / array_tmp[j] %= ( i = ; i != bi.len; ++ ( j = i, k = ; k != len; ++j, ++ x = bi.array[i] * array_tmp[j] += (array_tmp[j] >= array_tmp[j+] += array_tmp[j] / array_tmp[j] %= positive = (positive == bi.positive ? : memcpy(array, array_tmp, SIZE*( len = * big_int big_int:: - big_int tmp(* tmp.positive = ! big_int& big_int:: ++ () * += big_int( big_int big_int:: ++ ( big_int tmp(* ++* big_int& big_int:: -- () * -= big_int( big_int big_int:: -- ( big_int tmp(* --* big_int big_int::abs() big_int tmp(* tmp.positive = std::ostream& << (std::ostream& os, big_int& (! os<< ( i = bi.len-; i != -; -- os<< == ( big_int& lbi, big_int& (lbi.len != rbi.len || lbi.positive != ( i = ; i != lbi.len; ++ (lbi.array[i] != != ( big_int& lbi, big_int& !(lbi == < ( big_int& lbi, big_int& (lbi.positive != (lbi.positive == (lbi.len != (lbi.positive == && lbi.len > (lbi.positive == && lbi.len < (lbi.positive == && lbi.len > (lbi.positive == && lbi.len < (lbi.positive == ( i = lbi.len-; i != -; -- (lbi.array[i] == (lbi.array[i] < ( i = lbi.len-; i != -; -- (lbi.array[i] == (lbi.array[i] < big_int + ( big_int& lbi, big_int& tmp += big_int - ( big_int& lbi, big_int& tmp -= big_int * ( big_int& lbi, big_int& tmp *= }