1
int read() { char c=getchar();while(!isdigit(c)) c=getchar(); int num=0;while(isdigit(c)) num=num*10+c-'0',c=getchar(); return num; }
inline int read(){ int res=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();} while(ch>='0'&&ch<='9') res=res*10+ch-'0',ch=getchar(); return res*f; } inline void write(int x){ if(x<0) putchar('-'),x=-x; if(x<10) putchar(x+'0'); else{ write(x/10); putchar(x%10+'0'); } }
感觉用处不大嫌麻烦记不住,没用过,一直用2
2
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
简单清爽,cin和cout基本和scanf,printf差不多快,循环中的读入和输出如果怕TLE还是用scanf,printf
3
void sc(int& x) { scanf("%d", &x); }
void sc(int64_t& x) { scanf("%lld", &x); }
void sc(double& x) { scanf("%lf", &x); }
void sc(char& x) { scanf(" %c", &x); }
void sc(char* x) { scanf("%s", x); }
整一堆函数上去,读入直接sc(x);