代码IO板子

声明一下,以后为了防止篇幅,会删去头文件这些,但是,代码可以加上这里的东西,都保证是能过的。

#include <bits/stdc++.h>
#define int long long
#define vec problemU202035
using namespace std;
namespace IO {
int len = 0;
char ibuf[(1 << 20) + 1], *iS, *iT, out[(1 << 25) + 1];
#define gh()                                                                   \
  (iS == iT ? iT = (iS = ibuf) + fread(ibuf, 1, (1 << 20) + 1, stdin),         \
   (iS == iT ? EOF : *iS++) : *iS++)
inline int read() {
  char ch = gh();
  int x = 0;
  char t = 0;
  while (ch < '0' || ch > '9')
    t |= ch == '-', ch = gh();
  while (ch >= '0' && ch <= '9')
    x = x * 10 + (ch ^ 48), ch = gh();
  return t ? -x : x;
}
inline void putc(char ch) { out[len++] = ch; }
template <class T> inline void write(T x) {
  if (x < 0)
    putc('-'), x = -x;
  if (x > 9)
    write(x / 10);
  out[len++] = x % 10 + 48;
}
string getstr(void) {
  string s = "";
  char c = gh();
  while (c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == EOF)
    c = gh();
  while (!(c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == EOF))
    s.push_back(c), c = gh();
  return s;
}
void putstr(string str, int begin = 0, int end = -1) {
  if (end == -1)
    end = str.size();
  for (int i = begin; i < end; i++)
    putc(str[i]);
  return;
}
inline void flush() {
  fwrite(out, 1, len, stdout);
  len = 0;
}
} // namespace IO
using IO::flush;
using IO::getstr;
using IO::putc;
using IO::putstr;
using IO::read;
using IO::write;

posted @ 2021-08-19 20:37  Pitiless0514  阅读(128)  评论(0)    收藏  举报