高精度
2024-08-03 00:59:15 225人阅读
#include <cstdio>#include <iostream>#include <algorithm>#include <ctime>#include <cctype>#include <cmath>#include <string>#include <cstring>#include <stack>#include <queue>#include <list>#include <vector>#include <map>#include <set> #define sqr(x) ((x)*(x))#define LL long long#define INF 0x3f3f3f3f#define PI acos(-1.0)#define eps 1e-10#define maxn 1500 using namespace std;struct bign{ int len, s[maxn]; bign() { memset(s, 0, sizeof(s)); len = 1; } bign(int num) { *this = num; } bign(const char* num) { *this = num; } bign operator = (int num) { char s[maxn]; sprintf(s, "%d", num); *this = s; return *this; } bign operator = (const char* num) { len = strlen(num); for(int i = 0; i < len; i++) s[i] = num[len-i-1] - ‘0‘; return *this; } string str() const { string res = ""; for(int i = 0; i < len; i++) res = (char)(s[i] + ‘0‘) + res; if(res == "") res = "0"; return res; } bign operator + (const bign& b) const{ bign c; c.len = 0; for(int i = 0, g = 0; g || i