高精度板子

2022-05-06 16:33:11 字數 951 閱讀 9779

乘法學會fft以後,應該乘除都能優化很多。。

#include #include #include #include using namespace std;

int mi[28];

const int maxlen=2e5+16, maxbit=1e8;

int max(int a, int b)

void plus1()

};//並不是函式傳出來的東西不能引用,而是c++不允許臨時量被非常量引用

//因為不然你可以改變臨時量,這很奇怪

bool operator <(const bigint &a, const bigint &b)

bigint operator +(const bigint &x, const bigint &y)

if (re.a[maxlen]) re.len=maxlen+1;

else re.len=maxlen;

return re;

}//目前減法只處理自然數

bigint operator -(const bigint &a, const bigint &b)

for (; re.len>0&&!re.a[re.len-1]; --re.len);

return re;

}//n^2log1e8雙高精除法(fft後可以到nlog1e8)

bigint operator /(const bigint &x, const bigint &y)

}for (; re.len>0&&!re.a[re.len-1]; --re.len);

return re;

}bigint operator %(const bigint &x, const bigint &y)

}return tmp;

}void init()

bigint a, b;

int main()

高精度板子

include include include include include include include include include include include include include include include include include include using ...

高精度板子

include include include include include include include include include include include include include includeusing namespace std const int max 10001...

高精度板子

本章即將介紹的是一章高精度的板子,並沒有深奧的道理,大函式大 inline 者,暫且靠邊站,筆者沒有那麼高水平,滿足不了這些需求。本文如有理念上與邏輯上的錯誤,請多多包涵並且指出。什麼是高精度?高精度,雖然聽起來感覺很生熟,很深奧,但是,原理不過是小學二三年級時的加減法豎式和四五年級的乘法算式罷了,...