zoukankan      html  css  js  c++  java
  • 日常模板

    简洁版

    #include<bits/stdc++.h> 
    #define Pair pair<int, int>
    #define MP(x, y) make_pair(x, y)
    #define fi first
    #define se second
    #define pb push_back 
    //#define int long long 
    #define LL long long 
    #define ull unsigned long long 
    #define Fin(x) {freopen(#x".in","r",stdin);}
    #define Fout(x) {freopen(#x".out","w",stdout);}
    using namespace std;
    const int MAXN = 1e6 + 10, mod = 1e9 + 7, INF = 1e9 + 10;
    const double eps = 1e-9;
    template <typename A, typename B> inline bool chmin(A &a, B b){if(a > b) {a = b; return 1;} return 0;}
    template <typename A, typename B> inline bool chmax(A &a, B b){if(a < b) {a = b; return 1;} return 0;}
    template <typename A, typename B> inline LL add(A x, B y) {if(x + y < 0) return x + y + mod; return x + y >= mod ? x + y - mod : x + y;}
    template <typename A, typename B> inline void add2(A &x, B y) {if(x + y < 0) x = x + y + mod; else x = (x + y >= mod ? x + y - mod : x + y);}
    template <typename A, typename B> inline LL mul(A x, B y) {return 1ll * x * y % mod;}
    template <typename A, typename B> inline void mul2(A &x, B y) {x = (1ll * x * y % mod + mod) % mod;}
    template <typename A> inline void debug(A a){cout << a << '
    ';}
    template <typename A> inline LL sqr(A x){return 1ll * x * x;}
    template <typename A, typename B> inline LL fp(A a, B p, int md = mod) {int b = 1;while(p) {if(p & 1) b = mul(b, a);a = mul(a, a); p >>= 1;}return b;}
    template <typename A> A inv(A x) {return fp(x, mod - 2);}
    inline int read() {
        char c = getchar(); int x = 0, f = 1;
        while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
        while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
        return x * f;
    }
    signed main() {
    
        return 0;
    }
    

    完整版

    /*
    */
    #include<bits/stdc++.h> 
    //#include<bits/extc++.h>
    /*#include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<algorithm>
    #include<map>
    #include<vector>
    #include<set>
    #include<queue>
    #include<cmath>*/
    //#include<ext/pb_ds/assoc_container.hpp>
    //#include<ext/pb_ds/hash_policy.hpp>
    #define Pair pair<int, int>
    #define MP(x, y) make_pair(x, y)
    #define fi first
    #define se second
    //#define int long long 
    #define LL long long 
    #define ull unsigned long long 
    #define rg register 
    #define pt(x) printf("%d ", x);
    #define Fin(x) {freopen(#x".in","r",stdin);}
    #define Fout(x) {freopen(#x".out","w",stdout);}
    //#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1<<22, stdin), p1 == p2) ? EOF : *p1++)
    //char buf[(1 << 22)], *p1 = buf, *p2 = buf;
    //char obuf[1<<24], *O = obuf;
    //void print(int x) {if(x > 9) print(x / 10); *O++ = x % 10 + '0';}
    //#define OS  *O++ = ' ';
    //#define fout fwrite(obuf, O-obuf, 1 , stdout);
    using namespace std;
    //using namespace __gnu_pbds;
    const int MAXN = 1e6 + 10, INF = 1e9 + 10, mod = 1e9 + 7;
    const double eps = 1e-9;
    inline int read() {
        char c = getchar(); int x = 0, f = 1;
        while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
        while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
        return x * f;
    }
    struct InputOutputStream {
        enum { SIZE = 1000001 };
        char ibuf[SIZE], *s, *t, obuf[SIZE], *oh;
    
        InputOutputStream() : s(), t(), oh(obuf) {}
        ~InputOutputStream() { fwrite(obuf, 1, oh - obuf, stdout); }
    
        inline char read() {
            if (s == t) t = (s = ibuf) + fread(ibuf, 1, SIZE, stdin);
            return s == t ? -1 : *s++;
        }
    
        template <typename T>
        inline InputOutputStream &operator>>(T &x) {
            static char c;
            static bool iosig;
            for (c = read(), iosig = false; !isdigit(c); c = read()) {
                if (c == -1) return *this;
                iosig |= c == '-';
            }
            for (x = 0; isdigit(c); c = read()) x = x * 10 + (c ^ '0');
            if (iosig) x = -x;
            return *this;
        }
    
        inline void print(char c) {
            if (oh == obuf + SIZE) {
                fwrite(obuf, 1, SIZE, stdout);
                oh = obuf;
            }
            *oh++ = c;
        }
    
        template <typename T>
        inline void print(T x) {
            static int buf[23], cnt;
            if (x != 0) {
                if (x < 0) print('-'), x = -x;
                for (cnt = 0; x; x /= 10) buf[++cnt] = x % 10 | 48;
                while (cnt) print((char)buf[cnt--]);
            } else print('0');
        }
    
        template <typename T>
        inline InputOutputStream &operator<<(const T &x) {
            print(x);
            return *this;
        }
    } io;
    
    main() {
    
    
        return 0;
    }
    /*
    
    */
    
    
    #include<cstdio>
    #include<cstdlib>
    #include<cstring>
    #include<ctime>
    #include<iostream>
     
    using namespace std;
    
    #define problem "a" //输出文件名 
    #define prename "a" //更改之前的文件名 
    
    char ak[1000];
    
    int cases = 10;//数据组数 
    
    int mode = 1;//造数据 / 重新编号 
    
    int getrand() {
        return (rand() << 15) + rand() + 1;
    }
    
    long long getlong() {
        return ((long long)getrand() << 31) + getrand();
    }
    
    const int MAXN = 1e5 + 10;
    #define int long long
    #define ch(x, y) (test >= x && test <= y)
    void make_data(int test) {
    
    	int N, K, A, B, Lim;
    	A = getrand() % Lim, B = getrand() % Lim;
    	if(ch(1, 4)) Lim = 1e3;
    	else if(ch(5, 6)) Lim = 1e7;
    	else Lim = 1e13;
    	
    	N = rand() % Lim + 1, K = rand() % Lim + 1;
    	if(test == 4) N = 1e13, K = 1;
    	
    	cout << N << " " << K << " " << A << "  " << B;
    
    }
    #undef int 
    main() {
        //srand(time(0));
    
        for (int a = 1; a <= cases; a++) {
            fprintf(stderr, "%d
    ", a);
            if (mode == 1) {
                sprintf(ak, problem "%d.in", a);
                freopen(ak, "w", stdout);
    
                make_data(a);
    
                fclose(stdout);
    
    #ifdef unix
                sprintf(ak, "./" problem " < " problem "%d.in > " problem "%d.out", a, a);
    #else
                sprintf(ak, problem ".exe < " problem "%d.in > " problem "%d.out", a, a);
    #endif
    
                system(ak);
            }
            if (mode == 2) {
    #ifdef unix
                sprintf(ak, "mv " prename "%d.in " problem "%d.in", a, a);
    #else
                sprintf(ak, "rename " prename "%d.in " problem "%d.in", a, a);
    #endif
                system(ak);
    
    #ifdef unix
                sprintf(ak,"mv " prename "%d.out " problem "%d.out", a, a);
    #else
                sprintf(ak, "rename " prename "%d.out " problem "%d.out", a, a);
    #endif
                system(ak);
            }
        }
    
        return 0;
    }
    
    
  • 相关阅读:
    2021年1月1日 AutoCAD.Net/C#.Net QQ群:193522571 按顺序等距排列平行直线
    2021年1月1日 AutoCAD.Net/C#.Net QQ群:193522571GS标记子实体
    2021年1月1日 AutoCAD.Net/C#.Net QQ群:193522571获取和修改摘要信息
    2021年1月1日 AutoCAD.Net/C#.Net QQ群:193522571长事务
    2021年1月1日 AutoCAD.Net/C#.Net QQ群:193522571按表走呵呵!(延时死循环)
    2021年1月1日 AutoCAD.Net/C#.Net QQ群:193522571修改多段线的凸度
    2021年1月1日 AutoCAD.Net/C#.Net QQ群:193522571临时反应器的简单应用
    2021年1月1日 AutoCAD.Net/C#.Net QQ群:193522571自创实体类从AcDbCurve派生,实现一些类方法并动态绘制
    2021年1月1日 AutoCAD.Net/C#.Net QQ群:193522571多段线动态切割闭合区域
    动态块
  • 原文地址:https://www.cnblogs.com/zwfymqz/p/7874418.html
Copyright © 2011-2022 走看看