首页 > 其他分享 >缺省源

缺省源

时间:2024-09-30 16:47:26浏览次数:4  
标签:ch return int 缺省 while inline define

如果你要,拿走不谢

#include <bits/stdc++.h>
// #pragma GCC optimize(2)
#define int long long
#define pii pair<int, int>
#define tpi tuple<int, int, int, int>
#define il inline
#define p_q priority_queue
#define u_m unordered_map
#define bt bitset
#define rg register

using namespace std;

const int N1 = 300005;
const int N2 = 1000006;
const int mod = 998244353;

using i64 = long long;

void chmin(int& x, int c) {
    x = min(x, c);
}
void chmax(int& x, int c) {
    x = max(x, c);
}

namespace fast_IO {
#define IOSIZE 100000
int precision = 3, POW[10] = {1,      10,      100,      1000,      10000,
                              100000, 1000000, 10000000, 100000000, 1000000000};
char ibuf[IOSIZE], obuf[IOSIZE], *p1 = ibuf, *p2 = ibuf, *p3 = obuf;
// #ifdef ONLINE_JUDGE
// #define getchar()                                                         \
//     ((p1 == p2) and                                                       \
//              (p2 = (p1 = ibuf) + fread(ibuf, 1, IOSIZE, stdin), p1 == p2) \
//          ? (EOF)                                                          \
// : (*p1++))
// #define putchar(x)                                                             
//     ((p3 == obuf + IOSIZE) && (fwrite(obuf, p3 - obuf, 1, stdout), p3 = obuf), 
//      *p3++ = x)
// #define isdigit(ch) (ch > 47 && ch < 58)
// #define isspace(ch) (ch < 33)
// #endif
template <typename T>
inline T read() {
    T s = 0;
    int w = 1;
    char ch;
    while (ch = getchar(), !isdigit(ch) && (ch != EOF))
        if (ch == 45)
            w = -1;
    if (ch == EOF)
        return 0;
    while (isdigit(ch))
        s = s * 10 + ch - 48, ch = getchar();
    return s * w;
}
template <typename T>
inline bool read(T& s) {
    s = 0;
    int w = 1;
    char ch;
    while (ch = getchar(), !isdigit(ch) && (ch != EOF))
        if (ch == 45)
            w = -1;
    if (ch == EOF)
        return 0;
    while (isdigit(ch))
        s = s * 10 + ch - 48, ch = getchar();
    return s *= w, 1;
}
inline bool read(char& s) {
    while (s = getchar(), isspace(s))
        ;
    return 1;
}
inline bool read(char* s) {
    char ch;
    while (ch = getchar(), isspace(ch))
        ;
    if (ch == EOF)
        return 0;
    while (!isspace(ch))
        *s++ = ch, ch = getchar();
    *s = '\000';
    return 1;
}
template <typename T>
inline void print(T x) {
    if (x < 0)
        putchar(45), x = -x;
    if (x > 9)
        print(x / 10);
    putchar(x % 10 + 48);
}
inline void print(char x) {
    putchar(x);
}
inline void print(char* x) {
    while (*x)
        putchar(*x++);
}
inline void print(const char* x) {
    for (int i = 0; x[i]; i++)
        putchar(x[i]);
}
inline bool read(std::string& s) {
    s = "";
    char ch;
    while (ch = getchar(), isspace(ch))
        ;
    if (ch == EOF)
        return 0;
    while (!isspace(ch))
        s += ch, ch = getchar();
    return 1;
}
inline void print(std::string x) {
    for (int i = 0, n = x.size(); i < n; i++)
        putchar(x[i]);
}
inline bool read(bool& b) {
    char ch;
    while (ch = getchar(), isspace(ch))
        ;
    b = ch ^ 48;
    return 1;
}
inline void print(bool b) {
    putchar(b + 48);
}
inline bool read(double& x) {
    int a = 0, b = 0;
    char ch = getchar();
    bool f = 0;
    while (ch < 48 || ch > 57) {
        if (ch == 45)
            f = 1;
        ch = getchar();
    }
    while (47 < ch && ch < 58) {
        a = (a << 1) + (a << 3) + (ch ^ 48);
        ch = getchar();
    }
    if (ch != 46) {
        x = f ? -a : a;
        return 1;
    }
    ch = getchar();
    while (47 < ch && ch < 58) {
        b = (b << 1) + (b << 3) + (ch ^ 48), ch = getchar();
    }
    x = b;
    while (x > 1)        x /= 10;
        x /= 10;
    x = f ? -a - x : a + x;
    return 1;
}
inline void print(double x) {
    if (x < 0) {
        putchar(45), x = -x;
    }
    x = round((long double)x * POW[precision]) / POW[precision],
    print((long long)x), putchar(46), x -= (long long)(x);
    for (int i = 1; i <= precision; i++)
        x *= 10, putchar(x + 48), x -= (int)x;
}
template <typename T, typename... T1>
inline int read(T& a, T1&... other) {
    return read(a) + read(other...);
}
template <typename T, typename... T1>
inline void print(T a, T1... other) {
    print(a), print(other...);
}
struct Fast_IO {
    ~Fast_IO() { fwrite(obuf, p3 - obuf, 1, stdout); }
} io;
template <typename T>
Fast_IO& operator>>(Fast_IO& io, T& b) {
    return read(b), io;
}
template <typename T>
Fast_IO& operator<<(Fast_IO& io, T b) {
    return print(b), io;
}
#define cout io
#define cin io
}  // namespace fast_IO

namespace temp {
int fac[N2] = {0};
il void Cinit(int p) {
    fac[0] = 1;
    for (int i = 1; i < N2; i++) {
        fac[i] = fac[i - 1] * i % p;
    }
}
il int qpow(int a, int b, int p) {
    int ans = 1;
    while (b) {
        if (b & 1) {
            ans = ans * a % p;
        }
        a = a * a % p;
        b >>= 1;
    }
    return ans;
}
il int C(int n, int m, int p) {
    if (m > n || m < 0) {
        return 0;
    }
    return fac[n] * qpow(fac[m], p - 2, p) % p * qpow(fac[n - m], p - 2, p) % p;
}
il int Lucas(int n, int m, int p) {
    if (!m)
        return 1;
    return (C(n % p, m % p, p) * Lucas(n / p, m / p, p)) % p;
}
il int GCD(int n, int m, int p) {
    return __gcd(n, m) % p;
}
il int LCM(int n, int m, int p) {
    return n * m % p * qpow(GCD(n, m, p), p - 2, p) % p;
}
}  // namespace temp

//-----------------------------------------------------------------------------------------------//

using namespace fast_IO;

// #define debug 1
// #define multi_test_ 1
#define endl '\n'

int _test_ = 1;

namespace zqh {

void init() {
    ;
}

void solve() {
    ;
}

void main() {
    init();
    solve();
}
}  // namespace zqh

signed main() {
//     ios::sync_with_stdio(0);
//     cin.tie(0);
//     cout.tie(0);
#ifdef debug
    freopen("zqh.in", "r", stdin);
    freopen("zqh.out", "w", stdout);
#endif
#ifdef multi_test_
    cin >> _test_;
#endif
    while (_test_--) {
        zqh::main();
    }
    return 0;
}
/*

 */

vscode 模板代码

"#include <bits/stdc++.h>",
"// #pragma GCC optimize(2)",
"#define int long long",
"#define pii pair<int, int>",
"#define tpi tuple<int, int, int, int>",
"#define il inline",
"#define p_q priority_queue",
"#define u_m unordered_map",
"#define bt bitset",
"#define rg register",
"",
"using namespace std;",
"",
"const int N1 = 300005;",
"const int N2 = 1000006;",
"const int mod = 998244353;",
"",
"using i64 = long long;",
"",
"void chmin(int& x, int c) {",
"    x = min(x, c);",
"}",
"void chmax(int& x, int c) {",
"    x = max(x, c);",
"}",
"",
"namespace fast_IO {",
"#define IOSIZE 100000",
"int precision = 3, POW[10] = {1,      10,      100,      1000,      10000,",
"                              100000, 1000000, 10000000, 100000000, 1000000000};",
"char ibuf[IOSIZE], obuf[IOSIZE], *p1 = ibuf, *p2 = ibuf, *p3 = obuf;",
"// #ifdef ONLINE_JUDGE",
"// #define getchar()                                                         \\",
"//     ((p1 == p2) and                                                       \\",
"//              (p2 = (p1 = ibuf) + fread(ibuf, 1, IOSIZE, stdin), p1 == p2) \\",
"//          ? (EOF)                                                          \\",
"// : (*p1++))",
"// #define putchar(x)                                                             ",
"//     ((p3 == obuf + IOSIZE) && (fwrite(obuf, p3 - obuf, 1, stdout), p3 = obuf), ",
"//      *p3++ = x)",
"// #define isdigit(ch) (ch > 47 && ch < 58)",
"// #define isspace(ch) (ch < 33)",
"// #endif",
"template <typename T>",
"inline T read() {",
"    T s = 0;",
"    int w = 1;",
"    char ch;",
"    while (ch = getchar(), !isdigit(ch) && (ch != EOF))",
"        if (ch == 45)",
"            w = -1;",
"    if (ch == EOF)",
"        return 0;",
"    while (isdigit(ch))",
"        s = s * 10 + ch - 48, ch = getchar();",
"    return s * w;",
"}",
"template <typename T>",
"inline bool read(T& s) {",
"    s = 0;",
"    int w = 1;",
"    char ch;",
"    while (ch = getchar(), !isdigit(ch) && (ch != EOF))",
"        if (ch == 45)",
"            w = -1;",
"    if (ch == EOF)",
"        return 0;",
"    while (isdigit(ch))",
"        s = s * 10 + ch - 48, ch = getchar();",
"    return s *= w, 1;",
"}",
"inline bool read(char& s) {",
"    while (s = getchar(), isspace(s))",
"        ;",
"    return 1;",
"}",
"inline bool read(char* s) {",
"    char ch;",
"    while (ch = getchar(), isspace(ch))",
"        ;",
"    if (ch == EOF)",
"        return 0;",
"    while (!isspace(ch))",
"        *s++ = ch, ch = getchar();",
"    *s = '\\000';",
"    return 1;",
"}",
"template <typename T>",
"inline void print(T x) {",
"    if (x < 0)",
"        putchar(45), x = -x;",
"    if (x > 9)",
"        print(x / 10);",
"    putchar(x % 10 + 48);",
"}",
"inline void print(char x) {",
"    putchar(x);",
"}",
"inline void print(char* x) {",
"    while (*x)",
"        putchar(*x++);",
"}",
"inline void print(const char* x) {",
"    for (int i = 0; x[i]; i++)",
"        putchar(x[i]);",
"}",
"inline bool read(std::string& s) {",
"    s = \"\";",
"    char ch;",
"    while (ch = getchar(), isspace(ch))",
"        ;",
"    if (ch == EOF)",
"        return 0;",
"    while (!isspace(ch))",
"        s += ch, ch = getchar();",
"    return 1;",
"}",
"inline void print(std::string x) {",
"    for (int i = 0, n = x.size(); i < n; i++)",
"        putchar(x[i]);",
"}",
"inline bool read(bool& b) {",
"    char ch;",
"    while (ch = getchar(), isspace(ch))",
"        ;",
"    b = ch ^ 48;",
"    return 1;",
"}",
"inline void print(bool b) {",
"    putchar(b + 48);",
"}",
"inline bool read(double& x) {",
"    int a = 0, b = 0;",
"    char ch = getchar();",
"    bool f = 0;",
"    while (ch < 48 || ch > 57) {",
"        if (ch == 45)",
"            f = 1;",
"        ch = getchar();",
"    }",
"    while (47 < ch && ch < 58) {",
"        a = (a << 1) + (a << 3) + (ch ^ 48);",
"        ch = getchar();",
"    }",
"    if (ch != 46) {",
"        x = f ? -a : a;",
"        return 1;",
"    }",
"    ch = getchar();",
"    while (47 < ch && ch < 58) {",
"        b = (b << 1) + (b << 3) + (ch ^ 48), ch = getchar();",
"    }",
"    x = b;",
"    while (x > 1)",
"        x /= 10;",
"    x = f ? -a - x : a + x;",
"    return 1;",
"}",
"inline void print(double x) {",
"    if (x < 0) {",
"        putchar(45), x = -x;",
"    }",
"    x = round((long double)x * POW[precision]) / POW[precision],",
"    print((long long)x), putchar(46), x -= (long long)(x);",
"    for (int i = 1; i <= precision; i++)",
"        x *= 10, putchar(x + 48), x -= (int)x;",
"}",
"template <typename T, typename... T1>",
"inline int read(T& a, T1&... other) {",
"    return read(a) + read(other...);",
"}",
"template <typename T, typename... T1>",
"inline void print(T a, T1... other) {",
"    print(a), print(other...);",
"}",
"struct Fast_IO {",
"    ~Fast_IO() { fwrite(obuf, p3 - obuf, 1, stdout); }",
"} io;",
"template <typename T>",
"Fast_IO& operator>>(Fast_IO& io, T& b) {",
"    return read(b), io;",
"}",
"template <typename T>",
"Fast_IO& operator<<(Fast_IO& io, T b) {",
"    return print(b), io;",
"}",
"#define cout io",
"#define cin io",
"}  // namespace fast_IO",
"",
"namespace temp {",
"int fac[N2] = {0};",
"il void Cinit(int p) {",
"    fac[0] = 1;",
"    for (int i = 1; i < N2; i++) {",
"        fac[i] = fac[i - 1] * i % p;",
"    }",
"}",
"il int qpow(int a, int b, int p) {",
"    int ans = 1;",
"    while (b) {",
"        if (b & 1) {",
"            ans = ans * a % p;",
"        }",
"        a = a * a % p;",
"        b >>= 1;",
"    }",
"    return ans;",
"}",
"il int C(int n, int m, int p) {",
"    if (m > n || m < 0) {",
"        return 0;",
"    }",
"    return fac[n] * qpow(fac[m], p - 2, p) % p * qpow(fac[n - m], p - 2, p) % p;",
"}",
"il int Lucas(int n, int m, int p) {",
"    if (!m)",
"        return 1;",
"    return (C(n % p, m % p, p) * Lucas(n / p, m / p, p)) % p;",
"}",
"il int GCD(int n, int m, int p) {",
"    return __gcd(n, m) % p;",
"}",
"il int LCM(int n, int m, int p) {",
"    return n * m % p * qpow(GCD(n, m, p), p - 2, p) % p;",
"}",
"}  // namespace temp",
"",
"//-----------------------------------------------------------------------------------------------//",
"",
"using namespace fast_IO;",
"",
"// #define debug 1",
"// #define multi_test_ 1",
"#define endl '\\n'",
"",
"int _test_ = 1;",
"",
"namespace zqh {",
"$1",
"void init() {",
"    ;",
"}",
"",
"void solve() {",
"    ;",
"}",
"",
"void main() {",
"    init();",
"    solve();",
"}",
"}  // namespace zqh",
"",
"signed main() {",
"//     ios::sync_with_stdio(0);",
"//     cin.tie(0);",
"//     cout.tie(0);",
"#ifdef debug",
"    freopen(\"zqh.in\", \"r\", stdin);",
"    freopen(\"zqh.out\", \"w\", stdout);",
"#endif",
"#ifdef multi_test_",
"    cin >> _test_;",
"#endif",
"    while (_test_--) {",
"        zqh::main();",
"    }",
"    return 0;",
"}",
"/*",
"",
" */"

标签:ch,return,int,缺省,while,inline,define
From: https://www.cnblogs.com/zphh/p/18442117

相关文章

  • 改变您的HTTP服务器的缺省banner
    原文链接:https://www.cnblogs.com/zmbhfly/p/10510594.html改变您的HTTP服务器的缺省banner 针对IISAsp.net,改变您的HTTP服务器的缺省banner引自:https://www.cnblogs.com/felixnet/p/6344613.html测试可以用,但仅仅是修改的应用程序,http://localhost不起作用https:......
  • C++入门 一(命名空间,缺省参数,超详细!!!)
    文章目录C++与C语言的区别命名空间(Namespace)缺省参数C++与C语言的区别C++在保留了C语言所有特性的基础上增加了面向对象编程的支持,并引入了更多的高级特性和工具来提高代码的可读性、可维护性和可扩展性。而C语言则更加简洁和底层,适用于对性能要求极高或对内存管理......
  • 【C++】C++入门基础,详细介绍命名空间,缺省参数,函数重载,引用,内联函数等
    目录1.命名空间1.1使用命名空间的目的1.2 命名空间定义 1.3 命名空间使用2.缺省参数2.1 缺省参数概念2.2缺省参数分类2.3实际案例2.4 注意事项 3.函数重载3.1函数重载概念3.2函数重载原理 4.引用4.1引用的概念4.2引用的特性4.3 使用场景4.......
  • 缺省源
    /* Auth:Loxilante Date: Prog: Thinktwice,codeonce.Thinkonce,debugFOREVER!*/#defineF_C#include<bits/stdc++.h>#definerep(i,l,r)for(inti=l;i<r;i++)#definehrp(i,l,r)for(inti=l;i<=r;i++)#definerev(i,r......
  • C++入门基础—(命名空间,输入输出,缺省参数,函数重载)
    目录1.1 C++发展史1.2C++版本更新1.3C++学习参考文档1.4C++的第一个程序2命名空间2.1命名空间的价值2.2namespace的定义1.命名空间中可以定义变量/函数/类型2.命名空间可以嵌套3.多⽂件中可以定义同名namespace,他们会默认合并到⼀起,就像同⼀个namespace⼀......
  • C++入门(3)inline函数与缺省参数
    一.inline函数当程序执行函数调用时,系统要建立栈空间,保护现场,传递参数以及控制程序执行的转移等等,这些工作需要系统时间和空间的开销。当函数功能简单,使用频率很高,为了提高效率,直接将函数的代码镶嵌到程序中。但这个方法有缺点,一是相同代码重复书写,二是程序的可读性往往没有......
  • C++入门——“命名空间”、“缺省参数”、“函数重载”、“引用”
    C++在C语言的基础上增加了许多东西,在我看来,它和它的名字一样,是C语言的Plus的Plus版本,而且支持C语言的大部分语法,让码农写起来很是别有一番韵味。在这里向大家介绍C++的一些语法结构。一、命名空间    在进行C语言的开发当中,随着代码量的增加,或者工程变得复杂,我们进行......
  • 缺省源
    #include<bits/stdc++.h>usingnamespacestd;#definepiipair<int,int>#definefrfirst#definesesecond#definepbkpush_back#definemprmake_pair#definelllonglong#defineullunsignedlonglong#definerereturn#defineconcontinue#......
  • C++缺省参数、缺省参数的概念、缺省参数的分类、函数重载、函数重载的概念、C++支持函
    文章目录前言一、缺省参数1.缺省参数的概念2.缺省参数的分类二、函数重载1.函数重载的概念2.C++支持函数重载的原理三、引用1.引用的概念2.引用的特性3.常引用4.引用的使用场景5.传值和传引用效率比较6.引用和指针的区别总结前言C++缺省参数、缺省参数......
  • 缺省源
    缺省源fread快读namespaceIO{ charbuf[1<<20],*pa=buf,*pb=buf; #defineGc()(pa==pb&&(pb=(pa=buf)+fread(buf,1,1<<20,stdin),pa==pb)?EOF:*pa++) inlineintRead() { intx=0,f=1; charc=Gc(); wh......