#include #include#include
#include
using
namespace
std;
const
int maxn = 1000
;struct
bign
bign()
bign(
int num)
bign(
char* num)
bign
operator = (const
char*num)
bign
operator = (int
num)
bign
operator + (const bign&b)
while (c.d[i] > 9) c.d[i++]%=10, c.d[i]++;
c.len =max(len, b.len);
if (c.d[i] && c.len <= i) c.len = i+1
;
return
c; }
bign
operator - (const bign&b)
while (c.d[i] < 0) c.d[i++]+=10, c.d[i]--;
c.clean();
return
c; }
bign
operator * (const bign& b)const
bign
operator / (const bign&b)
c.clean();
return
c; }
bign
operator % (const bign&b)
return
a; }
bign
operator += (const bign&b)
bool
operator
<(const bign& b) const
bool
operator >(const bign& b) const
bool
operator
<=(const bign& b) const
bool
operator>=(const bign& b) const
bool
operator!=(const bign& b) const
bool
operator==(const bign& b) const
string str() const
;
for(int i = 0; i < len; i++) s[len-1-i] = d[i]+'0'
;
return
s; }
};istream& operator >> (istream& in, bign&x)
ostream& operator
<< (ostream& out, const bign&x)
intmain()
cout
return0;
}
寫了個沒有/和後面運算的簡單一點的。。都是自己可以理解語法
/也挺簡單 但感覺noip用不到
注意加完之後 要把剩下的10給模掉 剛開始這裡寫錯了
#include usingnamespace
std;
#define rg register
#define rint register int
#define il inline
#define rep(i,h,t) for (int i=h;i<=t;i++)
#define dep(i,t,h) for (int i=t;i>=h;i--)
#define me(x) memset(x,0,sizeof(x))
#define setit set::iterator
#define lowbit(x) (x&(-x))
#define fi first
#define se second
#define mp make_pair
#define mid ((h+t)>>1)
#define mid2 ((h+t+1)>>1)
#define ll long long
char ss[1
<<24],*a=ss,*b=ss;
il char
gc()
template
il void read(t &x)
char sr[1
<<24],z[20]; int c=-1
,z;template
il void
wer(t x)
il void
wer1()
il void
wer2()
template
il void maxa(rg t &x,rg t y)
template
il void mina(rg t &x,rg t y)
template
il t max(rg t x,rg t y)
template
il t min(rg t x,rg t y)
const
int inf=1e9;
struct
bign
bign()
bign(
char *c)
bign(
intnum)
bign
operator =(const
char *c)
bign
operator =(const
intnum)
; sprintf(s,"%d
",num);
*this=s;
return *this
; }
bign
operator +(const
bign c)
bign
operator *(const
bign c)
bool
operator
<(const
bign c)
}string
str()
;
for (int i=len-1;i>=0;i--) s[i]=d[len-i-1]+'0'
;
return
s; }
};bign f[
100];
int a[100
];bign g[
100][100
];int
main()
rep(j1,
0,m)
if (num1]) num=g[j1][j1+1
];
tt=tt+num;
} cout
fwrite(sr,
1,c+1
,stdout);
return0;
}
高精度模板
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型別的變數轉化為大...