Myself代码模板 发表于 2018-12-02 | 更新于 2019-01-29 | 评论数: | 阅读次数: 学啊学啊学太阳 template毒瘤警告 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136/* Headers */#include<cstdio>#include<cstring>#include<cctype>#include<algorithm>#include<climits>#include<vector>#include<queue>#include<cmath>/* define */#define FOR(i,a,b,c) for(int i=a;i<=b;i+=c)#define DOW(i,a,b,c) for(int i=a;i>=b;i-=c)#define LFO(i,a,b,c) for(long long i=a;i<=b;i+=c)#define LDO(i,a,b,c) for(long long i=a;i>=b;i-=c)/* namespaces */namespace FastIO{ const int BUFSIZE=1<<20; char ibuf[BUFSIZE],*is=ibuf,*its=ibuf; char obuf[BUFSIZE],*os=obuf,*ot=obuf+BUFSIZE; inline char getch(){ if(is==its) its=(is=ibuf)+fread(ibuf,1,BUFSIZE,stdin); return (is==its)?EOF:*is++; } inline int getint(){ int res=0,neg=0,ch=getch(); while(!(isdigit(ch)||ch=='-')&&ch!=EOF) ch=getch(); if(ch=='-'){ neg=1;ch=getch(); } while(isdigit(ch)){ res=(res<<3)+(res<<1)+(ch-'0'); ch=getch(); } return neg?-res:res; } inline void flush(){ fwrite(obuf,1,os-obuf,stdout); os=obuf; } inline void putch(char ch){ *os++=ch; if(os==ot) flush(); } inline void putint(int res){ static char q[10]; if(res==0) putch('0'); else if(res<0){ putch('-'); res=-res; } int top=0; while(res){ q[top++]=res%10+'0'; res/=10; } while(top--) putch(q[top]); }} namespace HashArray{ const int MAXS = 1e6+10; const int EMPTY = INT_MAX; int Hash[MAXS]; inline void clear(){ FOR(i,1,MAXS,1)Hash[i]=EMPTY; } inline int HashFunc(int x){ return x%MAXS; } inline int locate(int x){ int orgi=HashFunc(x); int p=0; while((p<MAXS)&&(Hash[(orgi+p)%MAXS]!=x)&&(Hash[(orgi+p)%MAXS]!=EMPTY))p++; return (orgi+i)%p; } inline bool insert(int x){ int posi=locate(x); if(Hash[posi]==EMPTY){ Hash[posi]=x; return true; } else return false; } inline bool member(int x){ int posi=locate(x); if(Hash[posi]==x)return true; return false; }}using namespace FastIO;using namespace HashArray;/* definitions */const int MAXN = 1e6+10;const int MOD = 1e9+7;/* functions */inline void init(){ #ifndef do #endif }inline long long mod(long long a,long long b,long long p){ return (a%p+b)%p;}inline long long gcd(long long a,long long b){ return (!b)?a:gcd(b,a%b);}inline long long lcm(long long a,long long b){ return (a/gcd(a,b))*(b/gcd(a,b))}inline long long quick_power(long long a,long long b,long long p){ long long ans=1,tmp=a; while(b){ if(b&1)ans=ans*tmp%p; tmp=tmp*tmp%p; b>>=1; } return ans;}inline bool is_prime(long long x){ if(x==1)return false; else if(x==2||x==3||x==5||x==7||x==11||x==13)return true; else{ LFO(i,2,sqrt(n)+1,1){ if(x%i==0)return false; else ; } } return true;}int main(int argc,char *argv[]){ #ifndef Herself32_FILE do #endif return 0;}