本文整理了在 OI 中可以提升读写速度的模板,持续更新中…
整型快读快写模板
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| #include<bits/stdc++.h> #define int long long using namespace std; inline void read(int& a) { int s=0,w=1; char ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-') w=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { s=s*10+ch-'0'; ch=getchar(); } a=s*w; return; } inline void write(int x) { static int sta[10]; int top=0; do { sta[top++]=x%10; x/=10; }while(x); while(top) putchar(sta[--top]+'0'); return; } signed main() { int a,b; read(a); read(b); write(a+b); return 0; }
|