没有高精类,因为这玩意太占内存了,正在优化
#include<bits/stdc++.h>
using namespace std;
namespace hdk{
const size_t size=100000;
template<typename T>
class vector{
private:T a[size];T* begind=a;T* endd=a;
public:
inline void push(T x){if(endd>a+size) exit(274);*endd=x;endd++;}
inline bool empty(){if(endd==begind) return true;return false;}
inline void pop(){if(endd==begind) exit(275);endd--;}
inline T back(){if(endd==begind) exit(275);return *(endd-1);}
inline T* begin(){return begind;}
inline T* end(){return endd+1;}
inline T get(int* x){if(x>endd) exit(276);return *x;}
inline int remain_size(){return size-(endd-begind);}
T* operator [](int x){if(begind+x>endd) endd=begind+x;return begind+x;}
inline void clear(){memset(a,0,sizeof a);endd=begind;}
};
template<typename T>
class stack{
private:T a[size];T* begind=a;T* endd=a;
public:
inline void push(T x){if(endd>a+size) exit(274);*endd=x;endd++;}
inline bool empty(){if(endd==begind) return true;return false;}
inline void pop(){if(endd==begind) exit(275);endd--;}
inline T back(){if(endd==begind) exit(275);return *(endd-1);}
inline T* begin(){return begind;}
inline T* end(){return endd+1;}
inline T get(int* x){if(x>endd) exit(276);return *x;}
inline int remain_size(){return size-(endd-begind);}
T* operator [](int x){return begind+x;}
inline void clear(){endd=begind;}
inline void push(hdk::vector<T> x){for(T* i=x.begin();i!=x.end();++i){push(*i);}}
};
class rander{
private:
std::vector<long long> list;
int it,ssize;
public:
inline int reset(int size){if(size<=0)return -1;int seed=std::rand();mt19937 Rand(seed);ssize=size;it=0;list.clear();for(int i=1;i<=size;++i){list.push_back(Rand());}return seed;}
inline int reset(){struct _timeb T;_ftime(&T);srand(T.millitm);return rander::reset(10000);}
inline std::vector<long long> randlist(int size){int seed=ssize;reset(size);std::vector<long long> ret=list;reset(seed);return ret;}
inline int rand(){if(ssize<=0)reset();int ret=list[it];it++;if(it>=ssize)reset(ssize);return ret;}
inline int rand(int mod){int ret=rander::rand()%mod;return ret;}
inline long long randabs(int mod){long long ret=abs(rander::rand());if(mod)ret%=mod;return ret;}
inline long long rand(int l,int r){if(l<0)return rander::rand(0,r);long ret=rander::randabs(r-l+1)+l;return ret;}
template<typename _T>inline _T from(vector<_T>p){long long ret=rander::randabs(p.size());return p[ret];}
template<typename _T>inline void randsort(vector<_T>&p){for(int i=1;i<=p.size();++i){int x=rander::rand(0,p.size()-1),y=rander::rand(0,p.size()-1);swap(p[x],p[y]);}}
template<typename _T>inline void randsort(_T &p,int from,int to){for(int i=1;i<=to-from+1;++i){int x=rander::rand(from,to),y=rander::rand(from,to);swap(p[x],p[y]);}}
};
template<typename F,typename S>
class demap{
private:
std::map<F,S> f;
std::map<S,F> s;
public:
inline void add(F Key,S Text){f[Key]=Text;s[Text]=Key;}
S find_text(F Key){return f[Key];}
F find_key(S Text){return s[Text];}
inline bool count_key(F Key){return f.count(Key);}
inline bool count_text(S Text){return s.count(Text);}
inline void clear(){s.clear();f.clear();}
inline bool empty(){return s.empty();}
};
class BIT{
private:
long long d[100001],di[100001],s[100001];
inline int lowbit(int x){return x&-x;}
void change(long long *c,int x,int y){while(x<=n){c[x]+=y;x+=lowbit(x);}}
long long sum(long long *c,int x){long long ans=0;while(x>0){ans+=c[x];x-=lowbit(x);}return ans;}
public:
int n;
void clear(){memset(d,0,sizeof(d));memset(di,0,sizeof(di));memset(s,0,sizeof(s));}
long long sum(int l,int r){return sum(r)-sum(l-1);}
void change(int x,int y,int changevalue){change(d,x,changevalue);change(d,y+1,-changevalue);change(di,x,changevalue*x);change(di,y+1,-changevalue*(y+1));}
void make_sum(int id,int x){s[id]=s[id-1]+x;}
long long sum(int id){return sum(id,id);}
void change(int id,int changevalue){change(id,id,changevalue);}
};
template<typename T>
class matrix{
private:int n,m,mod;bool ifmod;T mat[size+1][size+1];
public:
T get(int x,int y){return mat[x][y];}
void clear(){for(int i=1;i<=n;++i){for(int j=1;j<=m;++j){mat[i][j]=0;}}n=0;m=0;ifmod=false;mod=0;}
void setmod(int x){if(x==0){ifmod=false;}else{ifmod=true;}mod=x;}
void resize(int nsize,int msize){n=nsize;m=msize;}
void fillmain(int x){for(int i=1;i<=n;++i){mat[i][i]=x;}}
void fillsec(int x){for(int i=1;i<=n;++i){mat[i][n-i+1]=x;}}
void fill(int x){for(int i=1;i<=n;++i){for(int j=1;j<=m;++j){mat[i][j]=x;}}}
void fill(int x,int startn,int endn,int startm,int endm){for(int i=startn;i<=endn;++i){for(int j=startm;j<=endm;++j){mat[i][j]=x;}}}
void opposite(){for(int i=1;i<=n;++i){for(int j=1;j<=m;++j){mat[i][j]*=-1;}}}
void packed_clear(int nsize,int msize,int filln,int mod){clear();resize(nsize,msize);setmod(mod);fill(filln);}
void input(){cin>>n>>m;for(int i=1;i<=n;++i){for(int j=1;j<=m;++j){cin>>mat[i][j];}}}
void inputn(int nsize){n=nsize;cin>>m;for(int i=1;i<=n;++i){for(int j=1;j<=m;++j){cin>>mat[i][j];}}}
void inputm(int msize){m=msize;cin>>n;for(int i=1;i<=n;++i){for(int j=1;j<=m;++j){cin>>mat[i][j];}}}
void input(int nsize,int msize){n=nsize;m=msize;for(int i=1;i<=n;++i){for(int j=1;j<=m;++j){cin>>mat[i][j];}}}
void print(){for(int i=1;i<=n;++i){for(int j=1;j<=m;++j){cout<<mat[i][j]<<" ";}cout<<endl;}}
matrix<T> operator *(const matrix &A)const{matrix<T> p;p.packed_clear(n,A.m,0,mod);for(int i=1;i<=n;++i){for(int j=1;j<=A.m;++j){for(int k=1;k<=m;++k){if(ifmod){p.mat[i][j]+=(mat[i][k]*A.mat[k][j])%mod;p.mat[i][j]%=mod;}else{p.mat[i][j]+=mat[i][k]*A.mat[k][j];}}}}return p;}
matrix<T> operator +(const matrix &A)const{matrix<T> p;p.packed_clear(n,m,0,mod);for(int i=1;i<=n;++i){for(int j=1;j<=m;++j){if(ifmod){p.mat[i][j]=(mat[i][j]+A.mat[i][j])%mod;}else{p.mat[i][j]=mat[i][j]+A.mat[i][j];}}}return p;}
matrix<T> operator -(const matrix &A)const{matrix<T> p;p.packed_clear(n,m,0,mod);for(int i=1;i<=n;++i){for(int j=1;j<=m;++j){if(ifmod){p.mat[i][j]=(mat[i][j]-A.mat[i][j])%mod;}else{p.mat[i][j]=mat[i][j]-A.mat[i][j];}}}return p;}
matrix<T> operator ^(const long long times)const{matrix<T> p;p.packed_clear(n,m,1,mod);for(int i=1;i<=times;++i){p=p*(*this);}return p;}
matrix<T> operator |(long long times)const{matrix<T> base,p;p.packed_clear(n,m,0,mod);base.packed_clear(n,m,0,mod);base=(*this);p.fillmain(1);if(times<=0){return p;}while(times){if(times&1){p=p*base;}base=base*base;times>>=1;}return p;}
matrix<T> operator *(const int x)const{matrix<T> p;p.packed_clear(n,m,0,mod);for(int i=1;i<=n;++i){for(int j=1;j<=m;++j){if(ifmod){p.mat[i][j]=(mat[i][j]*x)%mod;}else{p.mat[i][j]=mat[i][j]*x;}}}return p;}
};
const long double eps=1e-7;
namespace SIEN_INT{
struct Eint{
int pow;
long double frac;
void clear(){pow=0;frac=0;}
void reco(){if(frac>0){while(frac<1){if(frac-1.0<eps) break;frac*=10;pow--;}while(frac>=10){if(frac-10.0<eps) break;frac/=10;pow++;}}if(frac<0){while(frac>-1){if(fabs(frac+1.0<eps)) break;frac*=10.0;pow--;}while(frac<=-10){if(fabs(frac+10.0<eps)) break;frac/=10.0;pow++;}}}
void print(){printf("%Lfe%d",frac,pow);}
void input(){cin>>frac>>pow;reco();}
void redpow(int to){while(pow!=to){pow--;frac*=10;}}
void operator =(const pair<long double,int> x){frac=x.first;pow=x.second;reco();}
void operator =(const int x){frac=x;pow=0;reco();}
bool operator >(const Eint &A)const{if(pow==A.pow) return frac>A.frac;return pow>A.pow;}
bool operator ==(const Eint &A)const{if(pow==A.pow&&fabs(frac-A.frac)<eps) return true;return false;}
bool operator <(const Eint &A)const{return !((*this>A)||(*this==A));}
bool operator >=(const Eint &A)const{return !(*this<A);}
bool operator <=(const Eint &A)const{return !(*this>A);}
Eint operator +(Eint &A){Eint ans;if(pow>A.pow) redpow(A.pow);else A.redpow(pow);ans.frac=frac+A.frac;ans.pow=pow;ans.reco();reco();A.reco();return ans;}
void operator +=(Eint &A){*this=*this+A;}
Eint operator -(Eint &A){Eint ans;if(pow>A.pow) redpow(A.pow);else A.redpow(pow);ans.frac=frac-A.frac;ans.pow=pow;ans.reco();reco();A.reco();return ans;}
void operator -=(Eint &A){*this=*this-A;}
Eint operator *(const Eint &A)const{Eint ans;ans.frac=frac*A.frac;ans.pow=pow+A.pow;ans.reco();return ans;}
void operator *=(const Eint &A){*this=*this*A;}
Eint operator /(const Eint &A)const{Eint ans;ans.frac=frac/A.frac;ans.pow=pow-A.pow;ans.reco();return ans;}
void operator /=(const Eint &A){*this=(*this/A);}
Eint operator ^(const int x){Eint ans;ans.frac=std::pow(frac,x);ans.pow=pow*x;ans.reco();return ans;}
void operator ^=(const int x){pow*=x;}
};
Eint e(int x){Eint ans;ans=x;return ans;}
pair<long double,int> E(long double _f,int _p){return make_pair(_f,_p);}
pair<long double,int> E(int _p,long double _f){return make_pair(_f,_p);}
}
namespace Iter{
void cout(std::vector<int> &_v,int _from,int _to,char _devide){std::vector<int>::iterator iter;std::vector<int>::reverse_iterator riter;
if(_from<_to){for(iter=_v.begin()+_from;iter!=_v.begin()+_to;++iter){std::cout<<*iter<<_devide;}}
else{for(riter=_v.rbegin()+_to;riter!=_v.rbegin()+_from;++riter){std::cout<<*riter<<_devide;}}}
}
template<typename T>
void memset(T a[],int _val,int _size){if(_val==0){for(T* i=a;i<=a+_size-1;++i) *i&=0;return;}for(T* i=a;i<=a+_size-1;++i)*i=_val;}
namespace fastio{
void rule(bool setting){std::ios::sync_with_stdio(setting);}
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-'){f=-1;}ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}return x*f;}
inline int read(int &A){A=read();return A;}
inline void write(int A){if(A<0){putchar('-');A=-A;}if(A>9){write(A/10);}putchar(A%10+'0');}
inline void write(char A){putchar(A);}
inline void space(){putchar(' ');}
inline void endl(){putchar('\n');}
#define read read()
#define w(a) write(a)
#define e endl()
#define s space()
#define we(a) write(a);endl()
#define ws(a) write(a);space()
}
}
标签:return,主说,int,pow,void,之前,一块,ans,inline
From: https://www.cnblogs.com/HaneDaCafe/p/18238889