卡常科技
针对于毒瘤出题人
IO optimize
cin/cout 很慢,但是
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cout<<endl;//Wrong
cout<<'\n';//Right
scanf/printf 比较快,但对于毒瘤还不够快,所以
(速度越快,优先级越大,大小显示优先级)
\[scanf < getchar \]\[printf < puts < putchar \]实在不能忍了,直接放大招:
namespace FastIO{
int read(){
int res=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9')f=ch=='-'?-1:f,ch=getchar();
while(ch>='0' && ch<='9')res=res*10+ch-'0',ch=getchar();
return res*f;
}
void write(int x){
if(x<0)putchar('-'),x=-x;
if(x>9)write(x/10);
putchar(x%10+'0');
}
long long readl(){
long long res=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9')f=ch=='-'?-1:f,ch=getchar();
while(ch>='0' && ch<='9')res=res*10+ch-'0',ch=getchar();
return res*f;
}
void writel(long long x){
if(x<0)putchar('-'),x=-x;
if(x>9)writel(x/10);
putchar(x%10+'0');
}
}
Bit calculation optimize
熟练使用位运算就好了,略
标签:10,ch,cout,long,科技,while,卡常,getchar From: https://www.cnblogs.com/life-of-a-libertine/p/18035847