模块复习,今天开头。
只记录自己会的,顺序不按难度。
运算
特殊(如[],(),.,->)高于单目高于双目高于赋值高于 , 。
右移用符号位补齐。
==0同!。[!=0]同!!。!=-1同~。==-1同!~。[!=-1]同!!~。
数组,结构体,指针
指针:偏移&参数类型,不用动态。
STL
记得写头文件。
进阶
namespace 先进防重名。
长了 auto,要用 lambda([](){})。
decltype 好像挺有用?不用可变参。
分支
不用 switch。
循环
不用 while。
变量
short:16,int/float:32,long long/double:64
语法基础
读入
const int Mxxx=1e5;
inline char gc()
{
// return getchar();
static char buf[Mxxx],*p1=buf,*p2=buf;
return p1==p2&&(p2=(p1=buf)+fread(buf,1,Mxxx,stdin),p1==p2)?EOF:*p1++;
}输出
const int Mxxx=1e5;
inline char pc(char ch,bool fl=false)
{
// return fl?0:putchar(ch),0;
static char buf[Mxxx],*p1=buf,*p2=buf+Mxxx;
return (fl||((*p1++=ch)&&p1==p2))&&(fwrite(buf,1,p1-buf,stdout),p1=buf),0;
}其他:' '=32,'\n'=10。