读优&&输优

时间:2023-12-18 12:33:38

很nb的技巧……
但奇怪的是只能对文件使用……

然而交到OJ上或者比赛的时候都没有关系→_→

我大概也只能弄弄这些花里胡哨的东西了→_→

原理不清楚,背个板子好了

//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,:;}
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,:;}
using namespace std;
char buf[<<],*p1=buf,*p2=buf;
inline char getc(){return p1==p2&&(p2=(p1=buf)+fread(buf,,<<,stdin),p1==p2)?EOF:*p1++;}
int read(){
R int res,f=;R char ch;
while((ch=getc())>''||ch<'')(ch=='-')&&(f=-);
for(res=ch-'';(ch=getc())>=''&&ch<='';res=res*+ch-'');
return res*f;
}
int read(char *s){
R int len=;R char ch;while(((ch=getc())>''||ch<''));
for(s[++len]=ch;(ch=getc())>=''&&ch<='';s[++len]=ch);
return s[len+]='\0',len;
}
double readdb()
{
R double x=,y=0.1,f=;R char ch;
while((ch=getc())>''||ch<'')(ch=='-')&&(f=-);
for(x=ch-'';(ch=getc())>=''&&ch<='';x=x*+ch-'');
for(ch=='.'&&(ch=getc());ch>=''&&ch<='';x+=(ch-'')*y,y*=0.1,ch=getc());
return x*f;
}
char sr[<<],z[];int C=-,Z=;
inline void Ot(){fwrite(sr,,C+,stdout),C=-;}
void print(R int x){
if(C><<)Ot();if(x<)sr[++C]='-',x=-x;
while(z[++Z]=x%+,x/=);
while(sr[++C]=z[Z],--Z);sr[++C]='\n';
}
const int P=;
inline void upd(R int &x,R int y){(x+=y)>=P?x-=P:;}
inline int add(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
R int res=;
for(;y;y>>=,x=mul(x,x))(y&)?res=mul(res,x):;
return res;
}