1
0
Fork 0

add: fast io

This commit is contained in:
arielherself 2025-01-16 00:16:38 +08:00
parent 29ae86a934
commit d2ae7650a0
Signed by: arielherself
SSH Key Fingerprint: SHA256:AK3cyo9tFsp7Mox7K0sYphleC8hReXhnRKxwuDT5LBc
2 changed files with 24 additions and 2 deletions

22
misc/fastio.cc Normal file
View File

@ -0,0 +1,22 @@
char *p1,*p2,buf[100000];
#define nc() (p1==p2 && (p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++)
inline int fastread() {
int x=0,f=1;
char ch=nc();
while(ch<48||ch>57) {
if(ch=='-') f=-1;
ch=nc();
}
while(ch>=48&&ch<=57)
x=x*10+ch-48,ch=nc();
return x*f;
}
void fastwrite(int x) {
if(x<0) putchar('-'),x=-x;
if(x>9) fastwrite(x/10);
putchar(x%10+'0');
return;
}