1. 程式人生 > 實用技巧 >【基礎】標準模板

【基礎】標準模板

#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define srt(x) sort(all(x))
#define uni(x) sort(all(x)), x.erase(unique(all(x)), x.end())
#define msv(x, v) memset((x), (v), sizeof(x))
#define ms(x) memset(x, 0, sizeof(x))
#define dbg(x) cerr << #x " = " << (x) << endl

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;

typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double PI = acos(-1.0);
const double EPS = 1e-9;
const int MOD = 1000000007;
//const int MOD = 998244353;

struct Scanner {

    bool hasNext = 1;

    int nextInt() {
        int res = 0;
        char flag = 1, ch = getchar();
        while(ch != EOF && !isdigit(ch)) {
            flag = (ch == '-') ? -flag : flag;
            ch = getchar();
        }
        while(ch != EOF && isdigit(ch)) {
            res = res * 10 + (ch - '0');
            ch = getchar();
        }
        hasNext &= (ch != EOF);
        return res;
    }

    ll nextLL() {
        ll res = 0;
        char flag = 1, ch = getchar();
        while(ch != EOF && !isdigit(ch)) {
            flag = (ch == '-') ? -flag : flag;
            ch = getchar();
        }
        while(ch != EOF && isdigit(ch)) {
            res = res * 10 + (ch - '0');
            ch = getchar();
        }
        hasNext &= (ch != EOF);
        return res;
    }

    char nextChar() {
        char ch = getchar();
        while(ch != EOF && isspace(ch))
            ch = getchar();
        hasNext &= (ch != EOF);
        return ch;
    }

    int nextString(char *str) {
        int len = 0;
        char ch = getchar();
        while(ch != EOF && isspace(ch))
            ch = getchar();
        while(ch != EOF && !isspace(ch)) {
            str[++len] = ch;
            ch = getchar();
        }
        str[len + 1] = 0;
        hasNext &= (ch != EOF);
        return len;
    }

} sc;

void rd(int &x) {
    x = sc.nextInt();
}

void rd(ll &x) {
    x = sc.nextLL();
}

void rd(char &x) {
    x = sc.nextChar();
}

void rd(char* x) {
    sc.nextString(x);
}

template <typename T>
void cmin(T &x, T y) {
    if(y < x)
        x = y;
}

template <typename T>
void cmax(T &x, T y) {
    if(y > x)
        x = y;
}

/* begin */

struct Solver {

    void InitOnce() {
//        int t = sc.nextInt();
//        dbg(t);
    }

    void Read() {
    }

    void Solve() {
    }

} solver;

/* end */

int main() {
#ifdef LOCAL
    freopen("A.txt", "r", stdin);
#endif // LOCAL
    solver.InitOnce();
    while(1) {
        solver.Read();
        if(!sc.hasNext)
            break;
        solver.Solve();
        if(!sc.hasNext)
            break;
    }
    return 0;
}