版本比较
快读
正文
增加 32 行删除 21 行
5 行未改动6789101112131415161718192016172122232420252622232425262728293031323334353132333435363637383940414243444546424748444549505152535450515556575859605657616263646566676869707172735 行未改动
- 空格换行自己输
```cpp#include <iostream>#include <cstring>
using namespace std;
namespace Fast_read{ // int -2147483648~2147483647 // 如果输入输出会有 -2147483648 (2^31) 记得开 long long // 只输入大写字母或小写字母可以修改快读字符串 // 空格换行自己输 int op, stk[35], top = 0; char c; int Fop, Fstk[35], Ftop = 0; char Fc; template <typename T> inline void read(T &w) inline void read(T &Fw) { w = 0, op = 1; do {c = getchar();}while ((c < '0' || c > '9') && c != '-'); if (c == '-') op = -1, c = getchar(); do {w = (w << 1) + (w << 3) + (c ^ 48), c = getchar();}while (c >= '0' && c <= '9'); w *= op; Fw = 0, Fop = 1; do {Fc = getchar();}while ((Fc < '0' || Fc > '9') && Fc != '-'); if (Fc == '-') Fop = -1, Fc = getchar(); do {Fw = (Fw << 1) + (Fw << 3) + (Fc ^ 48), Fc = getchar();}while (Fc >= '0' && Fc <= '9'); Fw *= Fop; } inline int read() { int w = 0; op = 1; do {c = getchar();}while ((c < '0' || c > '9') && c != '-'); if (c == '-') op = -1, c = getchar(); do {w = (w << 1) + (w << 3) + (c ^ 48), c = getchar();}while (c >= '0' && c <= '9'); return w * op; int Fw = 0; Fop = 1; do {Fc = getchar();}while ((Fc < '0' || Fc > '9') && Fc != '-'); if (Fc == '-') Fop = -1, Fc = getchar(); do {Fw = (Fw << 1) + (Fw << 3) + (Fc ^ 48), Fc = getchar();}while (Fc >= '0' && Fc <= '9'); return Fw * Fop; } template <typename T> inline void print(T ans) { top = 0; Ftop = 0; if (ans < 0) putchar('-'), ans = -ans; do {stk[ ++ top] = ans % 10, ans /= 10;}while (ans); while (top) putchar(stk[top -- ] ^ 48); do {Fstk[ ++ Ftop] = ans % 10, ans /= 10;}while (ans); while (Ftop) putchar(Fstk[Ftop -- ] ^ 48); } inline void read(char *s, int &len) { do {c = getchar();}while ((c < 'a' || c > 'z') && (c < 'A' || c > 'Z')); do {s[ ++ len] = c, c = getchar();}while ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')); do {Fc = getchar();}while ((Fc < 'a' || Fc > 'z') && (Fc < 'A' || Fc > 'Z')); do {s[ ++ len] = Fc, Fc = getchar();}while ((Fc >= 'a' && Fc <= 'z') || (Fc >= 'A' && Fc <= 'Z')); } inline void print(char *s, int &len) { top = 0; do {putchar(s[ ++ top]);}while (top <= len); Ftop = 0; do {putchar(s[ ++ Ftop]);}while (Ftop <= len); }
inline void read(char *s, int &len) { do {Fc = getchar();}while (Fc < '0' || Fc > '1'); do {s[ ++ len] = Fc, Fc = getchar();}while (Fc == '0' || Fc == '1'); }}
using namespace Fast_read;```