去年這個時候問親愛的hfu老師noip考不考高精度,hfu老師滿不在意地說這幾年早都不怎麼考了不用管。一年後的今天,只聽見機房門口:「好同yue們,這個高精度,還是要去看一下,哈~~~。萬一他考到了。。。」
好吧那就硬著頭皮自己寫模板吧。
估計即使用高精也是乘爆或者加爆long long應該不會是除法,再加上時間緊迫,先附上加減乘三種運算的模板。
codevs 3116 高精度加法
#include#include#include#includeusing namespace std;
#define fil(a,b) memset(a,b,sizeof(a))
const int maxn=10004;
struct none_negative_big_number_operate
void add()
if (a[mxlen+1]) printf("1");
for (int i=mxlen;i;--i) printf("%d",ans[i]);
puts("");
}}bn;
int main()
codevs 3115 高精度減法
#include#include#include#includeusing namespace std;
#define fil(a,b) memset(a,b,sizeof(a))
const int maxn=10004;
struct none_negative_big_number_operate
inline bool cmp()
return 0;
}void minus()
while (!ans[mxlen]&&mxlen) --mxlen;
if (!mxlen)
if (bg) printf("-");
while (mxlen) printf("%d",ans[mxlen--]);
puts("");
}}bn;
int main()
codevs 3117 高精度乘法
#include#include#include#includeusing namespace std;
#define fil(a,b) memset(a,b,sizeof(a))
const int maxn=10004;
struct none_negative_big_number_operate
void multiply()
while (mxlen) printf("%d",ans[mxlen--]);
puts("");
}}bn;
int main()
高精度模板
include include include includeusing namespace std define maxn 9999 define maxsize 10 define dlen 4 class bignum bignum const int 將乙個int型別的變數轉化為大數 big...
高精度模板
include include include include include using namespace std const int maxn 1000 struct bign bign operator const char num 過載運算子 bign const char num 支援初...
高精度模板
include include include includeusing namespace std define maxn 9999 define maxsize 10 define dlen 4 class bignum 建構函式 bignum const int 將乙個int型別的變數轉化為大...