丶帅气猛哥哥 發表於 2025-10-8 09:56:00

焦糖饼干头文件c++最新同步

<p><span class="math inline">\(\color{green}正在更新\)</span></p>
<p>windos-2.0</p>
<details>
<summary>点击查看代码</summary>
<pre><code>#define _WIN32_WINNT 0x0601
//#pragma cpp_std c++11
//你可以换成指令: -std=gnu++11
#include &lt;bits/stdc++.h&gt;
#include &lt;Windows.h&gt;
#include &lt;string&gt;
#include &lt;algorithm&gt;
#include &lt;stdexcept&gt;
#include &lt;cctype&gt;
#include &lt;mutex&gt;
#include &lt;fstream&gt;
#include &lt;chrono&gt;
#include &lt;conio.h&gt;
#include &lt;limits&gt;    // 用于清除输入缓冲区
#include &lt;wininet.h&gt;
#include &lt;shlobj.h&gt;
#include &lt;powrprof.h&gt;
#include &lt;lmaccess.h&gt;
#include &lt;tlhelp32.h&gt;
#include &lt;commctrl.h&gt;
#include &lt;shellapi.h&gt;
#include &lt;mmsystem.h&gt;
#include &lt;psapi.h&gt;
#include &lt;thread&gt;
#include &lt;vector&gt;
#include &lt;map&gt;
//#include &lt;unistd.h&gt; linux/macOS
using namespace std;

//你需要定义 _agree_ 表示同意 CC BY-NC-ND 4.0
#ifndef _agree_
#undef _JTBG_H_
#define _JTBG_H_
#endif

#ifndef _JTBG_H_
#define _JTBG_H_
#define MUL(a,b) (a)*(b)
#define __JTBG_NORETURN(a) ext(a)
#define MUS(a,b) (a)-(b)
#define PLS(a,b) (a)+(b)
#define DEF(a,b) (a)/(b)
class MD5
{
private:
    typedef unsigned int uint32;
    typedef unsigned long long uint64;

    struct Context
        {
      uint32 state;
      uint32 count;
      unsigned char buffer;
    };

    static void init(Context &amp;ctx)
        {
      ctx.count = ctx.count = 0;
      ctx.state = 0x67452301;
      ctx.state = 0xefcdab89;
      ctx.state = 0x98badcfe;
      ctx.state = 0x10325476;
    }

    static void update(Context &amp;ctx, const unsigned char *input, size_t length)
        {
      uint32 i, index, partLen;

      index = (uint32)((ctx.count &gt;&gt; 3) &amp; 0x3F);
      if ((ctx.count += ((uint32)length &lt;&lt; 3)) &lt; ((uint32)length &lt;&lt; 3))
            ctx.count++;
      ctx.count += (uint32)(length &gt;&gt; 29);

      partLen = 64 - index;
      if (length &gt;= partLen)
                {
            memcpy(&amp;ctx.buffer, input, partLen);
            transform(ctx.state, ctx.buffer);
            for (i = partLen; i + 63 &lt; length; i += 64)
                transform(ctx.state, &amp;input);
            index = 0;
      }
                else
                {
            i = 0;
      }
      memcpy(&amp;ctx.buffer, &amp;input, length - i);
    }

    static void final(unsigned char digest, Context &amp;ctx)
        {
      unsigned char padding = {0x80};
      unsigned char bits;
      size_t index, padLen;

      encode(bits, ctx.count, 8);
      index = (uint32)((ctx.count &gt;&gt; 3) &amp; 0x3f);
      padLen = (index &lt; 56) ? (56 - index) : (120 - index);
      update(ctx, padding, padLen);
      update(ctx, bits, 8);
      encode(digest, ctx.state, 16);
    }

    static void transform(uint32 state, const unsigned char block)
        {
      uint32 a = state, b = state, c = state, d = state, x;
      decode(x, block, 64);

      FF(a, b, c, d, x, 7, 0xd76aa478);
      FF(d, a, b, c, x, 12, 0xe8c7b756);
      FF(c, d, a, b, x, 17, 0x242070db);
      FF(b, c, d, a, x, 22, 0xc1bdceee);
      FF(a, b, c, d, x, 7, 0xf57c0faf);
      FF(d, a, b, c, x, 12, 0x4787c62a);
      FF(c, d, a, b, x, 17, 0xa8304613);
      FF(b, c, d, a, x, 22, 0xfd469501);
      FF(a, b, c, d, x, 7, 0x698098d8);
      FF(d, a, b, c, x, 12, 0x8b44f7af);
      FF(c, d, a, b, x, 17, 0xffff5bb1);
      FF(b, c, d, a, x, 22, 0x895cd7be);
      FF(a, b, c, d, x, 7, 0x6b901122);
      FF(d, a, b, c, x, 12, 0xfd987193);
      FF(c, d, a, b, x, 17, 0xa679438e);
      FF(b, c, d, a, x, 22, 0x49b40821);

      GG(a, b, c, d, x, 5, 0xf61e2562);
      GG(d, a, b, c, x, 9, 0xc040b340);
      GG(c, d, a, b, x, 14, 0x265e5a51);
      GG(b, c, d, a, x, 20, 0xe9b6c7aa);
      GG(a, b, c, d, x, 5, 0xd62f105d);
      GG(d, a, b, c, x, 9, 0x02441453);
      GG(c, d, a, b, x, 14, 0xd8a1e681);
      GG(b, c, d, a, x, 20, 0xe7d3fbc8);
      GG(a, b, c, d, x, 5, 0x21e1cde6);
      GG(d, a, b, c, x, 9, 0xc33707d6);
      GG(c, d, a, b, x, 14, 0xf4d50d87);
      GG(b, c, d, a, x, 20, 0x455a14ed);
      GG(a, b, c, d, x, 5, 0xa9e3e905);
      GG(d, a, b, c, x, 9, 0xfcefa3f8);
      GG(c, d, a, b, x, 14, 0x676f02d9);
      GG(b, c, d, a, x, 20, 0x8d2a4c8a);

      HH(a, b, c, d, x, 4, 0xfffa3942);
      HH(d, a, b, c, x, 11, 0x8771f681);
      HH(c, d, a, b, x, 16, 0x6d9d6122);
      HH(b, c, d, a, x, 23, 0xfde5380c);
      HH(a, b, c, d, x, 4, 0xa4beea44);
      HH(d, a, b, c, x, 11, 0x4bdecfa9);
      HH(c, d, a, b, x, 16, 0xf6bb4b60);
      HH(b, c, d, a, x, 23, 0xbebfbc70);
      HH(a, b, c, d, x, 4, 0x289b7ec6);
      HH(d, a, b, c, x, 11, 0xeaa127fa);
      HH(c, d, a, b, x, 16, 0xd4ef3085);
      HH(b, c, d, a, x, 23, 0x04881d05);
      HH(a, b, c, d, x, 4, 0xd9d4d039);
      HH(d, a, b, c, x, 11, 0xe6db99e5);
      HH(c, d, a, b, x, 16, 0x1fa27cf8);
      HH(b, c, d, a, x, 23, 0xc4ac5665);

      II(a, b, c, d, x, 6, 0xf4292244);
      II(d, a, b, c, x, 10, 0x432aff97);
      II(c, d, a, b, x, 15, 0xab9423a7);
      II(b, c, d, a, x, 21, 0xfc93a039);
      II(a, b, c, d, x, 6, 0x655b59c3);
      II(d, a, b, c, x, 10, 0x8f0ccc92);
      II(c, d, a, b, x, 15, 0xffeff47d);
      II(b, c, d, a, x, 21, 0x85845dd1);
      II(a, b, c, d, x, 6, 0x6fa87e4f);
      II(d, a, b, c, x, 10, 0xfe2ce6e0);
      II(c, d, a, b, x, 15, 0xa3014314);
      II(b, c, d, a, x, 21, 0x4e0811a1);
      II(a, b, c, d, x, 6, 0xf7537e82);
      II(d, a, b, c, x, 10, 0xbd3af235);
      II(c, d, a, b, x, 15, 0x2ad7d2bb);
      II(b, c, d, a, x, 21, 0xeb86d391);

      state += a;
      state += b;
      state += c;
      state += d;
    }

    static inline uint32 F(uint32 x, uint32 y, uint32 z) { return (x &amp; y) | (~x &amp; z); }
    static inline uint32 G(uint32 x, uint32 y, uint32 z) { return (x &amp; z) | (y &amp; ~z); }
    static inline uint32 H(uint32 x, uint32 y, uint32 z) { return x ^ y ^ z; }
    static inline uint32 I(uint32 x, uint32 y, uint32 z) { return y ^ (x | ~z); }

    static inline void FF(uint32 &amp;a, uint32 b, uint32 c, uint32 d, uint32 x, uint32 s, uint32 t)
        {
      a += F(b, c, d) + x + t;
      a = (a &lt;&lt; s) | (a &gt;&gt; (32 - s));
      a += b;
    }

    static inline void GG(uint32 &amp;a, uint32 b, uint32 c, uint32 d, uint32 x, uint32 s, uint32 t)
        {
      a += G(b, c, d) + x + t;
      a = (a &lt;&lt; s) | (a &gt;&gt; (32 - s));
      a += b;
    }

    static inline void HH(uint32 &amp;a, uint32 b, uint32 c, uint32 d, uint32 x, uint32 s, uint32 t)
        {
      a += H(b, c, d) + x + t;
      a = (a &lt;&lt; s) | (a &gt;&gt; (32 - s));
      a += b;
    }

    static inline void II(uint32 &amp;a, uint32 b, uint32 c, uint32 d, uint32 x, uint32 s, uint32 t)
        {
      a += I(b, c, d) + x + t;
      a = (a &lt;&lt; s) | (a &gt;&gt; (32 - s));
      a += b;
    }

    static void encode(unsigned char *output, const uint32 *input, size_t length)
        {
      for (size_t i = 0, j = 0; j &lt; length; i++, j += 4)
                {
            output = (unsigned char)(input &amp; 0xFF);
            output = (unsigned char)((input &gt;&gt; 8) &amp; 0xFF);
            output = (unsigned char)((input &gt;&gt; 16) &amp; 0xFF);
            output = (unsigned char)((input &gt;&gt; 24) &amp; 0xFF);
      }
    }

    static void decode(uint32 *output, const unsigned char *input, size_t length)
        {
      for (size_t i = 0, j = 0; j &lt; length; i++, j += 4)
            output = ((uint32)input) | (((uint32)input) &lt;&lt; 8) |
                     (((uint32)input) &lt;&lt; 16) | (((uint32)input) &lt;&lt; 24);
    }

public:
    static std::string hash(const std::string &amp;input)
        {
      Context ctx;
      init(ctx);
      update(ctx, (const unsigned char*)input.c_str(), input.length());
      unsigned char digest;
      final(digest, ctx);
      char hex_str;
      for (int i = 0; i &lt; 16; i++)
            sprintf(hex_str + i * 2, "%02x", digest);
      hex_str = '\0';
      return std::string(hex_str);
    }
};
//MD5::hash(str)

unsigned long long pHash(const string&amp; s)
{
    const unsigned long long base = 911382629ULL;
    const unsigned long long mod = 1000000000000000003ULL;
    unsigned long long hashValue = 0;
   
    // 使用传统for循环兼容C++98
    for (size_t i = 0; i &lt; s.size(); ++i)
        {
      char c = s;
      hashValue = (hashValue * base + static_cast&lt;unsigned long long&gt;(c)) % mod;
    }
   
    return hashValue;
}

struct StringHash
{
    static const unsigned long long base = 911382629ULL;
    static const unsigned long long mod = 1000000000000000003ULL;
    vector&lt;unsigned long long&gt; hash;
    vector&lt;unsigned long long&gt; power;
    StringHash(const string&amp; s)
        {
      int n = s.size();
      hash.resize(n + 1);
      power.resize(n + 1);
      power = 1;
      
      for (int i = 0; i &lt; n; ++i) {
            hash = (hash * base + static_cast&lt;unsigned long long&gt;(s)) % mod;
            power = (power * base) % mod;
      }
    }
    // 获取子串s的哈希值(0-based,包含l和r)
    unsigned long long getHash(int l, int r)
        {
      int len = r - l + 1;
      unsigned long long res = (hash - hash * power) % mod;
      return res &lt; 0 ? res + mod : res;
    }
};
//StringHash strHash(str);
//cout &lt;&lt; "前缀哈希完整字符串: " &lt;&lt; strHash.getHash(0, str.size()-1) &lt;&lt; endl;
//cout &lt;&lt; "子串哈希(0-4): " &lt;&lt; strHash.getHash(0, 4) &lt;&lt; " (对应\"Hello\")" &lt;&lt; endl;

size_t Hash(const string&amp; s)
{
    size_t hashVal = 0;
    for (size_t i = 0; i &lt; s.size(); ++i)
        {
      // 简单的哈希组合算法
      hashVal = hashVal * 31 + static_cast&lt;size_t&gt;(s);
    }
    return hashVal;
}   

struct Save
{
        string path;
        int errorlevel=-1;
        ifstream save_i;
        ofstream save_o;
        void setpt(string s)
        {
                path=s;
                return ;
        }
        void read_nol()
        {
                save_i.open(path.c_str());
                if(!save_i.good()) errorlevel=1100;
                return ;
        }
        void read_bin()
        {
                save_i.open(path.c_str(),ios::in|ios::binary);
                if(!save_i.good()) errorlevel=1100;
                return ;
        }
        void save_nol()
        {
                save_o.open(path.c_str());
                if(!save_o.good()) errorlevel=1000;
                return ;
        }
        void save_app()
        {
                save_o.open(path.c_str(),ios::app|ios::out);
                if(!save_o.good()) errorlevel=1000;
                return ;
        }
        void save_bin()
        {
                save_o.open(path.c_str(),ios::binary|ios::out);
                if(!save_o.good()) errorlevel=1000;
                return ;
        }
        //save_o.write(s.data(),s.size());
        void save_stop()
        {
//                save_i.close();
                save_o.close();
                return ;
        }
        void read_stop()
        {
                save_i.close();
//                save_o.close();
                return ;
        }
};

string FileMD5(string path)
{
        ifstream file(path,ios::in|ios::binary);
        if (!file.is_open())
        {
                return "";
        }
        string fileContent;
        file.seekg(0,ios::end);
        size_t fileSize = static_cast&lt;size_t&gt;(file.tellg());
        file.seekg(0,ios::beg);
        fileContent.reserve(fileSize);
        fileContent.assign(std::istreambuf_iterator&lt;char&gt;(file),std::istreambuf_iterator&lt;char&gt;());
        if (!file &amp;&amp; !file.eof())
        {
                return "";
        }
        return MD5::hash(fileContent);
}

void say(string s,int t)
{
        if(t&lt;0) return ;
        int len=int(s.length());
        for(int i=0;i&lt;len;i++)
        {
                cout&lt;&lt;s;
                Sleep(t);
        }
        return ;
}

void pause(string s)
{
    cout&lt;&lt;s&lt;&lt;endl;
    system("pause &gt; nul");
        return ;
}

int ext(int num)
{
        cout&lt;&lt;" Process exited with return value "&lt;&lt;num&lt;&lt;endl;
        exit(num);
        return num;
}

template &lt;typename to_string_T&gt;
string tostring(to_string_T k)
{
        stringstream ans;
        ans&lt;&lt;k;
        return ans.str();
}

int chkey(int t)
{
        if(t!=-1)
        {
                t*=100;
                while(t--)
                {
              if (_kbhit())
                        {
                    int key = _getch();
                    return key;
                      }
                   }
                return -1;
        }
        else
        {
                while(1)
                {
              if (_kbhit())
                        {
                    int key = _getch();
                    return key;
              }
            }
        }
}

enum Color
{
    BLACK = 0,
    BLUE = 1,
    GREEN = 2,
    CYAN = 3,
    RED = 4,
    MAGENTA = 5,
    BROWN = 6,
    LIGHT_GRAY = 7,
    DARK_GRAY = 8,
    LIGHT_BLUE = 9,
    LIGHT_GREEN = 10,
    LIGHT_CYAN = 11,
    LIGHT_RED = 12,
    LIGHT_MAGENTA = 13,
    YELLOW = 14,
    WHITE = 15
};

void scg(Color x,Color y)
{
        HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    // 设置文本颜色和背景颜色,高4位是背景,低4位是文本
    SetConsoleTextAttribute(hConsole, (y &lt;&lt; 4) | x);
        return ;
}

void scg(int x,int y)
{
        HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    // 设置文本颜色和背景颜色,高4位是背景,低4位是文本
    SetConsoleTextAttribute(hConsole, (y &lt;&lt; 4) | x);
        return ;
}

void set_back_color()
{
        scg(7,0);
        return ;
}

int rd(int a,int b)
{
        srand(GetTickCount()+rand());
        return a+rand()%(b+1);
}

enum TimeType
{
        yer=0,
        mon=1,
        dat=2,
        hor=3,
        mit=4,
        sec=5,
        mst=6,
};
int Gettime(TimeType x)
{
        time_t now = time(0);
        tm *localTime = localtime(&amp;now);
        if(x==0) return 1900 + localTime-&gt;tm_year;//年份
        if(x==1) return 1 + localTime-&gt;tm_mon;//月份
        if(x==2) return localTime-&gt;tm_mday;//日期
        if(x==3) return localTime-&gt;tm_hour;//小时
        if(x==4) return localTime-&gt;tm_min;//分钟
        if(x==5) return localTime-&gt;tm_sec;//秒
        if(x==6) return GetTickCount();//ms
        return -1;
}
int Gettime(string x)
{
        time_t now = time(0);
        tm *localTime = localtime(&amp;now);
        if(x=="year") return 1900 + localTime-&gt;tm_year;//年份
        if(x=="mon") return 1 + localTime-&gt;tm_mon;//月份
        if(x=="dat") return localTime-&gt;tm_mday;//日期
        if(x=="hor") return localTime-&gt;tm_hour;//小时
        if(x=="mit") return localTime-&gt;tm_min;//分钟
        if(x=="sec") return localTime-&gt;tm_sec;//秒
        if(x=="mst") return GetTickCount();//ms
        return -1;
}

//控制台光标位置控制
void setcursor(int x,int y)
{
        COORD coord;
        coord.X = x;
        coord.Y = y;
        SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}

//隐藏/显示控制台光标
void setCVis(bool visible)
{
        CONSOLE_CURSOR_INFO cursorInfo = {1, visible};
        SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &amp;cursorInfo);
}

//获取控制台尺寸
void getCSize(int &amp;width,int &amp;height)
{
        CONSOLE_SCREEN_BUFFER_INFO csbi;
        GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &amp;csbi);
        width = csbi.srWindow.Right - csbi.srWindow.Left + 1;
        height = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
}

//生成指定长度的随机字符串
string randS(int length)
{
        const string chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
        string result;
        for (int i = 0; i &lt; length; ++i) {
                result += chars;
        }
        return result;
}

//计算文件大小(字节)
long long getFileSize(const string &amp;filename)
{
        ifstream file(filename, ios::binary | ios::ate);
        if(!file.good()) return -1;
        return static_cast&lt;long long&gt;(file.tellg());
}

//延迟函数(高精度ms)
void msSleep(int milliseconds)
{
        auto start = chrono::high_resolution_clock::now();
        while (chrono::duration_cast&lt;chrono::milliseconds&gt;(chrono::high_resolution_clock::now() - start).count() &lt; milliseconds);
}

//检测文件读写是否
bool fileok(const string &amp;filename)
{
        ifstream file(filename);
        return file.good();
}

//清除控制台指定区域内容
void clearCA(int x, int y, int width, int height)
{
        for(int i=0;i&lt;height;i++)
        {
                setcursor(x, y + i);
                cout &lt;&lt; string(width, ' ');
        }
}

//计算文件夹内文件数量(仅统计一级目录)
int getFileCountInDir(const string&amp; dirPath) {
        int count = 0;
        WIN32_FIND_DATA findData;
        HANDLE hFind = FindFirstFile((dirPath + "\\*").c_str(), &amp;findData);
        if (hFind == INVALID_HANDLE_VALUE) return -1;
        do
        {
                if (!(findData.dwFileAttributes &amp; FILE_ATTRIBUTE_DIRECTORY))
                {
                        count++; // 只统计文件,不统计文件夹
                }
        } while (FindNextFile(hFind, &amp;findData) != 0);
        FindClose(hFind);
        return count;
}

double random(double min, double max)
{
        return min + (max - min) * (rand() / (double)RAND_MAX);
}

//检查字符串是否为数字(整数或小数)
bool isNumber(const string&amp; str)
{
        if (str.empty()) return false;
        size_t start = 0;
        if (str == '+' || str == '-') start = 1;
        bool hasDot = false;
        for (size_t i = start; i &lt; str.size(); ++i)
        {
                if (str == '.')
                {
                        if (hasDot) return false;
                        hasDot = true;
                }
                else if (!isdigit(str))
                {
                        return false;
                }
        }
        return true;
}

struct memory
{
        long long bytes;
        double toB()
        {
                return static_cast&lt;double&gt;(bytes);
        }
        double toKB()
        {
                const double KB = 1024.0;
                return bytes / KB;
        }
        double toMB()
        {
                const double MB = 1024.0 * 1024.0;
                return bytes / MB;
        }
        double toGB()
        {
                const double GB = 1024.0 * 1024.0 * 1024.0;
                return bytes / GB;
        }
        double toTB()
        {
                const double TB = 1024.0 * 1024.0 * 1024.0 * 1024.0;
                return bytes / TB;
        }
        double toPB()
        {
                const double PB = 1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0;
                return bytes / PB;
        }
};

// 将字节转换为B(字节)
double rtoB(int bytes)
{
        return static_cast&lt;double&gt;(bytes);
}
// 将字节转换为KB(千字节)
double rtoKB(int bytes)
{
        const double KB = 1024.0;
        return bytes / KB;
}
// 将字节转换为MB(兆字节)
double rtoMB(int bytes)
{
        const double MB = 1024.0 * 1024.0;
        return bytes / MB;
}
// 将字节转换为GB(千兆字节)
double rtoGB(int bytes)
{
        const double GB = 1024.0 * 1024.0 * 1024.0;
        return bytes / GB;
}
// 将字节转换为TB(太字节)
double rtoTB(int bytes)
{
        const double TB = 1024.0 * 1024.0 * 1024.0 * 1024.0;
        return bytes / TB;
}
// 将字节转换为PB(拍字节)
double rtoPB(int bytes)
{
        const double PB = 1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0;
        return bytes / PB;
}

void lowerstring(string &amp;s)
{
        for(int i=0;i&lt;int(s.size());i++)
        {
                if(s&gt;='A'&amp;&amp;s&lt;='Z')
                {
                        s=s-'A'+'a';
                }
        }
        return ;
}
void uperstring(string &amp;s)
{
        for(int i=0;i&lt;int(s.size());i++)
        {
                if(s&gt;='a'&amp;&amp;s&lt;='z')
                {
                        s=s-'a'+'A';
                }
        }
        return ;
}

void flushed()
{
        cin.ignore(numeric_limits&lt;streamsize&gt;::max(), '\n');
        cin.clear();
        return ;
}

//xor加/解密
string xorpass(const string &amp;str, const string &amp;key)
{
        string result = str;
        size_t keyLen = key.size();
        if (keyLen == 0) return result;
        for (size_t i = 0; i &lt; result.size(); ++i)
        {
                result ^= key;
        }
        return result;
}

string base64up(const string &amp;str,const string &amp;base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
{
       
        string result;
        int val = 0, valBits = 0;
        for (unsigned char c : str)
        {
                val = (val &lt;&lt; 8) + c;
                valBits += 8;
                while (valBits &gt;= 6)
                {
                        result += base64Chars[(val &gt;&gt; (valBits - 6)) &amp; 0x3F];
                        valBits -= 6;
                }
        }
        if (valBits &gt; 0)
        {
                val &lt;&lt;= (6 - valBits);
                result += base64Chars;
        }
        while (result.size() % 4 != 0)
        {
                result += '=';
        }
        return result;
}
string base64dec(const string &amp;str,const string base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
{
        string result;
        vector&lt;int&gt; val(4, -1);
        for (size_t i = 0; i &lt; str.size(); ++i)
        {
                char c = str;
                if (c == '=') break;
                size_t pos = base64Chars.find(c);
                if (pos == string::npos) continue;
                val = pos;
                if (i % 4 == 3)
                {
                        result += (val &lt;&lt; 2) + ((val &gt;&gt; 4) &amp; 0x3);
                        if (val != -1)
                        {
                                result += ((val &lt;&lt; 4) &amp; 0xF0) + ((val &gt;&gt; 2) &amp; 0xF);
                        }
                        if (val != -1)
                        {
                                result += ((val &lt;&lt; 6) &amp; 0xC0) + val;
                        }
                        val.assign(4, -1);
                }
        }
        return result;
}

void Testsuper(string &amp;s)
{
        if (s.empty()) return;
        s = toupper(s);
        for (size_t i = 1; i &lt; s.size();i++)
        {
                s=tolower(s);
        }
}

struct Timer
{
        private:
                using Clock = std::chrono::high_resolution_clock;
                using TimePoint = std::chrono::time_point&lt;Clock&gt;;
               
                TimePoint start_;
                TimePoint pause_;
                bool isRunning_;
                std::chrono::duration&lt;double&gt; elapsed_;
               
        public:
                Timer() : isRunning_(false), elapsed_(0) {}
                void starttick()
                {
                        if (!isRunning_)
                        {
                                start_ = Clock::now();
                                isRunning_ = true;
                        }
                }
                void pausetick()
                {
                        if (isRunning_)
                        {
                                pause_ = Clock::now();
                                elapsed_ += pause_ - start_;
                                isRunning_ = false;
                        }
                }
                void resettick()
                {
                        isRunning_ = false;
                        elapsed_ = std::chrono::duration&lt;double&gt;(0);
                }
                double timesec()
                const
                {
                        if (isRunning_)
                        {
                                auto now = Clock::now();
                                return (elapsed_ + (now - start_)).count();
                        }
                        return elapsed_.count();
                }
                double timemst()
                const
                {
                        return timesec() * 1000.0;
                }
};

#ifndef _NOMATH_
#define _NOMATH_
constexpr double PI = 3.14159265358979323846264338327950288419716939937510582097494459;
constexpr double E = 2.71828182845904523536;
constexpr double SQRT2 = 1.41421356237309504880;
constexpr double DEG_TO_RAD = PI / 180.0;// 角度转弧度系数
constexpr double RAD_TO_DEG = 180.0 / PI;// 弧度转角度系数
//角度转弧度
inline double toRadians(double degrees)
{
        return degrees * DEG_TO_RAD;
}

// 弧度转角度
inline double toDegrees(double radians)
{
        return radians * RAD_TO_DEG;
}

// 计算阶乘
inline long long fac(int n)
{
        if(n&lt;0) return -1;
        long long result = 1;
        for (int i = 2; i &lt;= n; ++i)
        {
                result *= i;
        }
        return result;
}

double qpow(double base, int exponent)
{
        if (exponent==0) return 1.0;
        if (base==0) return 0.0;
        bool isNegative = exponent &lt; 0;
        unsigned int absExponent = static_cast&lt;unsigned int&gt;(isNegative ? -exponent : exponent);
        double result = 1.0;
        double current = base;
        while (absExponent &gt; 0)
        {
                if (absExponent % 2 == 1)
                {
                        result *= current;
                }
                current *= current;   
                absExponent /= 2;      
        }
        return isNegative ? 1.0 / result : result;
}

long long A(int a, int b)
{
        if(a &lt; 0 || b &lt; 0 || a &lt; b)
        {
                return -1;
        }
        if (b == 0)
        {
                return 1;
        }
        long long result = 1;
        for (int i = 0; i &lt; b; ++i)
        {
                result *= (a - i);
                if (result &lt; 0)
                {
                        return -1;
                }
        }
        return result;
}

long long C(int a, int b)
{
        if (a &lt; 0 || b &lt; 0 || a &lt; b)
        {
                return -1;
        }
        if (b == 0 || a == b)
        {
                return 1;
        }
        b = min(b, a - b);
        long long result = 1;
        for (int i = 1; i &lt;= b; ++i)
        {
                result = result * (a - b + i) / i;
                if (result &lt; 0)
                {
                        return -1;
                }
        }
        return result;
}

bool isHe(int x)
{
        if(x&lt;2) return 0;
        for(int i=2;i*i&lt;=x;i++)
        {
                if(x%i==0) return 0;
        }
        return 1;
}
#endif

#ifndef _NOSHORT_
#define _NOSHORT_
#define syst system("cls")
#define sys(x) system(x)
#define no_pause() system("pause &gt; nul")
#define pause() system("pause")
#define to_int(x) stoi(x)                   // 转换为int类型
#define to_long(x) stol(x)                  // 转换为long类型
#define to_double(x) stod(x)                // 转换为double类型
#define to_str(x) tostring(x)               // 转换为string类型
#define sleep(ms) Sleep(ms)               // 延迟指定毫秒数
#define time_now() time(0)                  // 获取当前时间戳(秒级)
#define getms() GetTickCount()
#define shuta() system("shutdown -a")
#define shuts() system("shutdown -s -t 0")
#define shutr() system("shutdown -g -t 0")
#define about() jtbg_h_about()
#endif

struct logger
{
        Save rep;
        enum error_type
        {
                error=0,
                info=1,
                warn=2,
                debug=3,
        };
        void reset_logger(string path)
        {
                rep.setpt(path);
                rep.save_nol();
                rep.save_o&lt;&lt;"["&lt;&lt;Gettime(yer)&lt;&lt;"/"&lt;&lt;Gettime(mon)&lt;&lt;"/"&lt;&lt;Gettime(dat)&lt;&lt;"-"&lt;&lt;Gettime(hor)&lt;&lt;":"&lt;&lt;Gettime(mit)&lt;&lt;":"&lt;&lt;Gettime(sec)&lt;&lt;"]"&lt;&lt;endl;
                return ;
        }
        void report(string s,error_type tp)
        {
                rep.save_o&lt;&lt;"["&lt;&lt;Gettime(hor)&lt;&lt;":"&lt;&lt;Gettime(mit)&lt;&lt;":"&lt;&lt;Gettime(sec)&lt;&lt;"("&lt;&lt;Gettime(mst)%1000&lt;&lt;")] ";
                if(tp==0) rep.save_o&lt;&lt;"{type=error} ";
                else if(tp==1) rep.save_o&lt;&lt;"{type=info} ";
                else if(tp==2) rep.save_o&lt;&lt;"{type=warn} ";
                else if(tp==3) rep.save_o&lt;&lt;"{type=debug} ";
                else rep.save_o&lt;&lt;"{type=unknow} ";
                rep.save_o&lt;&lt;s&lt;&lt;endl;
                flush(rep.save_o);
                return ;
        }
        void stop()
        {
                rep.save_stop();
                return ;
        }
};

void thred(logger p,string s)
{
        p.report(s,logger::error);
        return ;
}

string xorFile(const string&amp; filePath,const string&amp; key)
{
        if (key.empty())
        {
                return "";
        }
        std::ifstream file(filePath.c_str(), std::ios::in | std::ios::binary);
        if (!file.is_open())
        {
                return "";
        }
        std::string fileContent;
        char buffer;
        while (file.read(buffer, sizeof(buffer)))
        {
                fileContent.append(buffer, sizeof(buffer));
        }
        fileContent.append(buffer, file.gcount());
        const size_t keyLen = key.size();
        size_t keyIndex = 0;
        for (string::iterator it = fileContent.begin(); it != fileContent.end(); ++it)
        {
                *it = static_cast&lt;char&gt;(static_cast&lt;uint8_t&gt;(*it) ^ static_cast&lt;uint8_t&gt;(key));
                keyIndex = (keyIndex + 1) % keyLen;
        }
        return fileContent;
}

void xortoFile(const string&amp; filePath,const string&amp; key)
{
        if (key.empty())
        {
                return ;
        }
        ifstream file(filePath.c_str(),ios::in | ios::binary);
        if (!file.is_open())
        {
                return ;
        }
        string fileContent;
        char buffer;
        while (file.read(buffer, sizeof(buffer)))
        {
                fileContent.append(buffer, sizeof(buffer));
        }
        fileContent.append(buffer, file.gcount());
        file.close();
        const size_t keyLen = key.size();
        size_t keyIndex = 0;
        for (std::string::iterator it = fileContent.begin(); it != fileContent.end(); ++it)
        {
                *it = static_cast&lt;char&gt;(static_cast&lt;uint8_t&gt;(*it) ^ static_cast&lt;uint8_t&gt;(key));
                keyIndex = (keyIndex + 1) % keyLen;
        }
        std::ofstream outFile(filePath.c_str(), std::ios::out | std::ios::binary | std::ios::trunc);
        if (outFile.is_open())
        {
                outFile.write(fileContent.data(), fileContent.size());
                outFile.close();
        }
}

void caesarFile(const string&amp; filePath,int shift)
{
        shift %= 256;
        if (shift &lt; 0)
        {
                shift += 256;
        }
        std::ifstream file(filePath.c_str(), std::ios::in | std::ios::binary);
        if (!file.is_open())
        {
                return ;
        }
        string fileContent;
        char buffer;
        while (file.read(buffer, sizeof(buffer)))
        {
                fileContent.append(buffer, sizeof(buffer));
        }
        fileContent.append(buffer, file.gcount());
        file.close();
        for(string::iterator it = fileContent.begin(); it != fileContent.end();it++)
        {
                *it = static_cast&lt;char&gt;((static_cast&lt;uint8_t&gt;(*it) + shift) % 256);
        }
        std::ofstream outFile(filePath.c_str(), std::ios::out | std::ios::binary | std::ios::trunc);
        if (outFile.is_open())
        {
                outFile.write(fileContent.data(), fileContent.size());
                outFile.close();
        }
}
//加
void FileCEnc(const string&amp; filePath, int shift)
{
        caesarFile(filePath, shift);
}
//解
void FileCDec(const string&amp; filePath, int shift)
{
        caesarFile(filePath, 256 - (shift % 256));
}

//加密
string CEnc(const string&amp; input, int shift)
{
        shift %= 256;
        if (shift &lt; 0)
        {
                shift += 256;
        }
        string result = input;
        const size_t len = result.size();
        for (size_t i = 0; i &lt; len; ++i)
        {
                result = static_cast&lt;char&gt;((static_cast&lt;uint8_t&gt;(result) + shift) % 256);
        }
        return result;
}

//解密
string CDec(const string&amp; input, int shift)
{
        shift %= 256;
        if (shift &lt; 0)
        {
                shift += 256;
        }
        return CEnc(input, 256 - shift);
}

void jtbg_h_about()
{
        cout&lt;&lt;"jtbg.h\n";
        cout&lt;&lt;"wroten by @jiaotangbinggan\n";
        cout&lt;&lt;"Process start with 2025/10/4\n";
        cout&lt;&lt;"Lv: 2.0.0 -std11\n";
        cout&lt;&lt;"Used CC BY-NC-ND 4.0\n";
        cout&lt;&lt;"join&amp;talk to me(us):"&lt;&lt;endl;
        cout&lt;&lt;"luogu-1497734"&lt;&lt;endl;
        cout&lt;&lt;"197474286@qq.com"&lt;&lt;endl;
        cout&lt;&lt;"guitu1125@yeah.net"&lt;&lt;endl;
        cout&lt;&lt;"this file hash:none"&lt;&lt;endl;
        cout&lt;&lt;"this file will be new in a long time"&lt;&lt;endl;
        return ;
}
#endif
</code></pre>
</details>
<p>linux/macOS-Unix</p>
<details>
<summary>点击查看代码</summary>
<pre><code>#define _JTBG_UNIX_VERSION "2.0.0(unix-1.0.0) -std=c++11"
#define _JTBG_LICENSE "CC BY-NC-ND 4.0"
// 适配Linux/macOS平台,替换Windows依赖头文件
#include &lt;bits/stdc++.h&gt;
#include &lt;unistd.h&gt;
#include &lt;sys/ioctl.h&gt;
#include &lt;termios.h&gt;
#include &lt;sys/stat.h&gt;
#include &lt;dirent.h&gt;
#include &lt;fcntl.h&gt;
#include &lt;sys/time.h&gt;
#include &lt;ctime&gt;
#include &lt;cstdint&gt;
#include &lt;csignal&gt;
#include &lt;locale&gt;
#include &lt;codecvt&gt;
using namespace std;

// 防止头文件重复包含
#ifndef _JTBG_UNIX_H_
#define _JTBG_UNIX_H_

// 基础数学运算宏定义
#define MUL(a,b) (a)*(b)
#define __JTBG_NORETURN(a) ext(a)
#define MUS(a,b) (a)-(b)
#define PLS(a,b) (a)+(b)
#define DEF(a,b) ((b)!=0?(a)/(b):throw invalid_argument("Division by zero"))

// ========================== 1. 哈希计算模块 ==========================
class MD5
{
private:
        typedef uint32_t uint32;
        typedef uint64_t uint64;
        struct Context
        {
                uint32 state;
                uint32 count;
                unsigned char buffer;
        };
       
        static void init(Context &amp;ctx)
        {
                ctx.count = ctx.count = 0;
                ctx.state = 0x67452301;
                ctx.state = 0xefcdab89;
                ctx.state = 0x98badcfe;
                ctx.state = 0x10325476;
        }
       
        static void update(Context &amp;ctx, const unsigned char *input, size_t length)
        {
                uint32 i, index, partLen;
                index = (uint32)((ctx.count &gt;&gt; 3) &amp; 0x3F);
               
                if ((ctx.count += ((uint32)length &lt;&lt; 3)) &lt; ((uint32)length &lt;&lt; 3))
                        ctx.count++;
                ctx.count += (uint32)(length &gt;&gt; 29);
               
                partLen = 64 - index;
                if (length &gt;= partLen) {
                        memcpy(&amp;ctx.buffer, input, partLen);
                        transform(ctx.state, ctx.buffer);
                        for (i = partLen; i + 63 &lt; length; i += 64)
                                transform(ctx.state, &amp;input);
                        index = 0;
                } else {
                        i = 0;
                }
                memcpy(&amp;ctx.buffer, &amp;input, length - i);
        }
       
        static void final(unsigned char digest, Context &amp;ctx)
        {
                unsigned char padding = {0x80};
                unsigned char bits;
                size_t index, padLen;
               
                encode(bits, ctx.count, 8);
                index = (uint32)((ctx.count &gt;&gt; 3) &amp; 0x3f);
                padLen = (index &lt; 56) ? (56 - index) : (120 - index);
               
                update(ctx, padding, padLen);
                update(ctx, bits, 8);
                encode(digest, ctx.state, 16);
        }
       
        static void transform(uint32 state, const unsigned char block)
        {
                uint32 a = state, b = state, c = state, d = state, x;
                decode(x, block, 64);
               
#define FF(a,b,c,d,x,s,t) { a += F(b,c,d) + x + t; a = (a &lt;&lt; s) | (a &gt;&gt; (32 - s)); a += b; }
#define GG(a,b,c,d,x,s,t) { a += G(b,c,d) + x + t; a = (a &lt;&lt; s) | (a &gt;&gt; (32 - s)); a += b; }
#define HH(a,b,c,d,x,s,t) { a += H(b,c,d) + x + t; a = (a &lt;&lt; s) | (a &gt;&gt; (32 - s)); a += b; }
#define II(a,b,c,d,x,s,t) { a += I(b,c,d) + x + t; a = (a &lt;&lt; s) | (a &gt;&gt; (32 - s)); a += b; }
               
                FF(a,b,c,d,x,7,0xd76aa478); FF(d,a,b,c,x,12,0xe8c7b756);
                FF(c,d,a,b,x,17,0x242070db); FF(b,c,d,a,x,22,0xc1bdceee);
                FF(a,b,c,d,x,7,0xf57c0faf); FF(d,a,b,c,x,12,0x4787c62a);
                FF(c,d,a,b,x,17,0xa8304613); FF(b,c,d,a,x,22,0xfd469501);
                FF(a,b,c,d,x,7,0x698098d8); FF(d,a,b,c,x,12,0x8b44f7af);
                FF(c,d,a,b,x,17,0xffff5bb1); FF(b,c,d,a,x,22,0x895cd7be);
                FF(a,b,c,d,x,7,0x6b901122); FF(d,a,b,c,x,12,0xfd987193);
                FF(c,d,a,b,x,17,0xa679438e); FF(b,c,d,a,x,22,0x49b40821);
               
                GG(a,b,c,d,x,5,0xf61e2562); GG(d,a,b,c,x,9,0xc040b340);
                GG(c,d,a,b,x,14,0x265e5a51); GG(b,c,d,a,x,20,0xe9b6c7aa);
                GG(a,b,c,d,x,5,0xd62f105d); GG(d,a,b,c,x,9,0x02441453);
                GG(c,d,a,b,x,14,0xd8a1e681); GG(b,c,d,a,x,20,0xe7d3fbc8);
                GG(a,b,c,d,x,5,0x21e1cde6); GG(d,a,b,c,x,9,0xc33707d6);
                GG(c,d,a,b,x,14,0xf4d50d87); GG(b,c,d,a,x,20,0x455a14ed);
                GG(a,b,c,d,x,5,0xa9e3e905); GG(d,a,b,c,x,9,0xfcefa3f8);
                GG(c,d,a,b,x,14,0x676f02d9); GG(b,c,d,a,x,20,0x8d2a4c8a);
               
                HH(a,b,c,d,x,4,0xfffa3942); HH(d,a,b,c,x,11,0x8771f681);
                HH(c,d,a,b,x,16,0x6d9d6122); HH(b,c,d,a,x,23,0xfde5380c);
                HH(a,b,c,d,x,4,0xa4beea44); HH(d,a,b,c,x,11,0x4bdecfa9);
                HH(c,d,a,b,x,16,0xf6bb4b60); HH(b,c,d,a,x,23,0xbebfbc70);
                HH(a,b,c,d,x,4,0x289b7ec6); HH(d,a,b,c,x,11,0xeaa127fa);
                HH(c,d,a,b,x,16,0xd4ef3085); HH(b,c,d,a,x,23,0x04881d05);
                HH(a,b,c,d,x,4,0xd9d4d039); HH(d,a,b,c,x,11,0xe6db99e5);
                HH(c,d,a,b,x,16,0x1fa27cf8); HH(b,c,d,a,x,23,0xc4ac5665);
               
                II(a,b,c,d,x,6,0xf4292244); II(d,a,b,c,x,10,0x432aff97);
                II(c,d,a,b,x,15,0xab9423a7); II(b,c,d,a,x,21,0xfc93a039);
                II(a,b,c,d,x,6,0x655b59c3); II(d,a,b,c,x,10,0x8f0ccc92);
                II(c,d,a,b,x,15,0xffeff47d); II(b,c,d,a,x,21,0x85845dd1);
                II(a,b,c,d,x,6,0x6fa87e4f); II(d,a,b,c,x,10,0xfe2ce6e0);
                II(c,d,a,b,x,15,0xa3014314); II(b,c,d,a,x,21,0x4e0811a1);
                II(a,b,c,d,x,6,0xf7537e82); II(d,a,b,c,x,10,0xbd3af235);
                II(c,d,a,b,x,15,0x2ad7d2bb); II(b,c,d,a,x,21,0xeb86d391);
               
#undef FF
#undef GG
#undef HH
#undef II
               
                state += a;
                state += b;
                state += c;
                state += d;
        }
       
        static inline uint32 F(uint32 x, uint32 y, uint32 z) { return (x &amp; y) | (~x &amp; z); }
        static inline uint32 G(uint32 x, uint32 y, uint32 z) { return (x &amp; z) | (y &amp; ~z); }
        static inline uint32 H(uint32 x, uint32 y, uint32 z) { return x ^ y ^ z; }
        static inline uint32 I(uint32 x, uint32 y, uint32 z) { return y ^ (x | ~z); }
       
        static void encode(unsigned char *output, const uint32 *input, size_t length)
        {
                for (size_t i = 0, j = 0; j &lt; length; i++, j += 4)
                {
                        output = (unsigned char)(input &amp; 0xFF);
                        output = (unsigned char)((input &gt;&gt; 8) &amp; 0xFF);
                        output = (unsigned char)((input &gt;&gt; 16) &amp; 0xFF);
                        output = (unsigned char)((input &gt;&gt; 24) &amp; 0xFF);
                }
        }
       
        static void decode(uint32 *output, const unsigned char *input, size_t length)
        {
                for (size_t i = 0, j = 0; j &lt; length; i++, j += 4)
                        output = ((uint32)input) | (((uint32)input) &lt;&lt; 8) |
                        (((uint32)input) &lt;&lt; 16) | (((uint32)input) &lt;&lt; 24);
        }
       
public:
        static string hash(const string &amp;input)
        {
                Context ctx;
                init(ctx);
                update(ctx, (const unsigned char*)input.c_str(), input.length());
               
                unsigned char digest;
                final(digest, ctx);
               
                char hex_str;
                for (int i = 0; i &lt; 16; i++)
                        snprintf(hex_str + i * 2, 3, "%02x", digest);
                hex_str = '\0';
               
                return string(hex_str);
        }
};

// 字符串哈希(多项式哈希)
unsigned long long pHash(const string&amp; s)
{
        const unsigned long long base = 911382629ULL;
        const unsigned long long mod = 1000000000000000003ULL;
        unsigned long long hashValue = 0;
       
        for (size_t i = 0; i &lt; s.size(); ++i)
        {
                char c = s;
                hashValue = (hashValue * base + static_cast&lt;unsigned long long&gt;(c)) % mod;
        }
       
        return hashValue;
}

// 前缀哈希(支持子串哈希计算)
struct StringHash
{
        static const unsigned long long base = 911382629ULL;
        static const unsigned long long mod = 1000000000000000003ULL;
        vector&lt;unsigned long long&gt; hash;
        vector&lt;unsigned long long&gt; power;
       
        StringHash(const string&amp; s)
        {
                int n = s.size();
                hash.resize(n + 1);
                power.resize(n + 1);
                power = 1;
               
                for (int i = 0; i &lt; n; ++i) {
                        hash = (hash * base + static_cast&lt;unsigned long long&gt;(s)) % mod;
                        power = (power * base) % mod;
                }
        }
       
        // 获取子串s的哈希值(0-based,包含l和r)
        unsigned long long getHash(int l, int r)
        {
                if (l &gt; r || l &lt; 0 || r &gt;= (int)hash.size()-1)
                        throw invalid_argument("Invalid substring range");
               
                int len = r - l + 1;
                unsigned long long res = (hash - hash * power) % mod;
                return res &lt; 0 ? res + mod : res;
        }
};

// 基础字符串哈希(31为基数)
size_t Hash(const string&amp; s)
{
        size_t hashVal = 0;
        for (size_t i = 0; i &lt; s.size(); ++i)
        {
                hashVal = hashVal * 31 + static_cast&lt;size_t&gt;(s);
        }
        return hashVal;
}

// ========================== 2. 文件操作模块 ==========================
struct Save
{
        string path;
        int errorlevel = -1;// 1100:读失败, 1000:写失败
        ifstream save_i;
        ofstream save_o;
       
        // 设置文件路径
        void setpt(const string&amp; s) { path = s; }
       
        // 文本方式读取(无锁)
        void read_nol()
        {
                save_i.open(path.c_str());
                if (!save_i.good())
                        errorlevel = 1100;
        }
       
        // 二进制方式读取
        void read_bin()
        {
                save_i.open(path.c_str(), ios::in | ios::binary);
                if (!save_i.good())
                        errorlevel = 1100;
        }
       
        // 文本方式写入(覆盖)
        void save_nol()
        {
                save_o.open(path.c_str());
                if (!save_o.good())
                        errorlevel = 1000;
        }
       
        // 文本方式追加写入
        void save_app()
        {
                save_o.open(path.c_str(), ios::app | ios::out);
                if (!save_o.good())
                        errorlevel = 1000;
        }
       
        // 二进制方式写入(覆盖)
        void save_bin()
        {
                save_o.open(path.c_str(), ios::binary | ios::out);
                if (!save_o.good())
                        errorlevel = 1000;
        }
       
        // 关闭写入流
        void save_stop() { save_o.close(); }
       
        // 关闭读取流
        void read_stop() { save_i.close(); }
};

// 计算文件MD5值
string FileMD5(const string&amp; path)
{
        ifstream file(path, ios::in | ios::binary);
        if (!file.is_open())
                return "";
       
        string fileContent;
        file.seekg(0, ios::end);
        size_t fileSize = static_cast&lt;size_t&gt;(file.tellg());
        file.seekg(0, ios::beg);
       
        fileContent.reserve(fileSize);
        fileContent.assign(istreambuf_iterator&lt;char&gt;(file), istreambuf_iterator&lt;char&gt;());
       
        if (!file &amp;&amp; !file.eof())
                return "";
       
        return MD5::hash(fileContent);
}

// 获取文件大小(字节)
long long getFileSize(const string&amp; filename)
{
        struct stat fileStat;
        if (stat(filename.c_str(), &amp;fileStat) != 0)
                return -1;
        return static_cast&lt;long long&gt;(fileStat.st_size);
}

// 检查文件是否可读写
bool fileok(const string&amp; filename)
{
        ifstream file(filename);
        return file.good();
}

// 统计文件夹内文件数量(仅一级目录,不包含子文件夹)
int getFileCountInDir(const string&amp; dirPath)
{
        DIR* dir = opendir(dirPath.c_str());
        if (dir == nullptr)
                return -1;
       
        int count = 0;
        struct dirent* entry;
        while ((entry = readdir(dir)) != nullptr)
        {
                // 跳过.和..目录
                if (strcmp(entry-&gt;d_name, ".") == 0 || strcmp(entry-&gt;d_name, "..") == 0)
                        continue;
               
                // 判断是否为文件(非目录)
                string fullPath = dirPath + "/" + entry-&gt;d_name;
                struct stat statBuf;
                if (stat(fullPath.c_str(), &amp;statBuf) == 0 &amp;&amp; S_ISREG(statBuf.st_mode))
                        count++;
        }
       
        closedir(dir);
        return count;
}

// ========================== 3. 控制台控制模块 ==========================
// 控制台颜色枚举(ANSI转义码对应)
enum Color
{
        BLACK = 30,      // 前景色:黑
        RED = 31,      // 前景色:红
        GREEN = 32,      // 前景色:绿
        YELLOW = 33,   // 前景色:黄
        BLUE = 34,       // 前景色:蓝
        MAGENTA = 35,    // 前景色:品红
        CYAN = 36,       // 前景色:青
        WHITE = 37,      // 前景色:白
        BRIGHT_BLACK = 90,   // 亮前景:黑
        BRIGHT_RED = 91,   // 亮前景:红
        BRIGHT_GREEN = 92,   // 亮前景:绿
        BRIGHT_YELLOW = 93,// 亮前景:黄
        BRIGHT_BLUE = 94,    // 亮前景:蓝
        BRIGHT_MAGENTA = 95, // 亮前景:品红
        BRIGHT_CYAN = 96,    // 亮前景:青
        BRIGHT_WHITE = 97,   // 亮前景:白
        // 背景色(+40)
        BG_BLACK = 40,
        BG_RED = 41,
        BG_GREEN = 42,
        BG_YELLOW = 43,
        BG_BLUE = 44,
        BG_MAGENTA = 45,
        BG_CYAN = 46,
        BG_WHITE = 47,
        BG_BRIGHT_BLACK = 100,
        BG_BRIGHT_RED = 101,
        BG_BRIGHT_GREEN = 102,
        BG_BRIGHT_YELLOW = 103,
        BG_BRIGHT_BLUE = 104,
        BG_BRIGHT_MAGENTA = 105,
        BG_BRIGHT_CYAN = 106,
        BG_BRIGHT_WHITE = 107
};

// 设置控制台文本颜色(前景色+背景色)
void scg(Color fg, Color bg)
{
        cout &lt;&lt; "\033[" &lt;&lt; static_cast&lt;int&gt;(fg) &lt;&lt; ";" &lt;&lt; static_cast&lt;int&gt;(bg) &lt;&lt; "m";
}

// 重置控制台颜色为默认
void set_back_color()
{
        cout &lt;&lt; "\033[0m"; // ANSI重置码
}

// 获取控制台尺寸(宽x高,单位:字符)
void getCSize(int &amp;width, int &amp;height)
{
        struct winsize w;
        ioctl(STDOUT_FILENO, TIOCGWINSZ, &amp;w);
        width = w.ws_col;
        height = w.ws_row;
}

// 设置控制台光标位置(x:列,y:行,0-based)
void setcursor(int x, int y)
{
        cout &lt;&lt; "\033[" &lt;&lt; (y + 1) &lt;&lt; ";" &lt;&lt; (x + 1) &lt;&lt; "H"; // ANSI光标定位码(1-based)
}

// 隐藏/显示控制台光标
void setCVis(bool visible)
{
        if (visible)
                cout &lt;&lt; "\033[?25h"; // 显示光标
        else
                cout &lt;&lt; "\033[?25l"; // 隐藏光标
}

// 清除控制台指定区域内容(x:起始列,y:起始行,width:宽度,height:高度)
void clearCA(int x, int y, int width, int height)
{
        for (int i = 0; i &lt; height; ++i)
        {
                setcursor(x, y + i);
                cout &lt;&lt; string(width, ' ');
        }
        setcursor(x, y); // 回到起始位置
}

// 清除整个控制台
void syst()
{
        cout &lt;&lt; "\033[2J\033[H"; // ANSI清屏+光标归位
}

// ========================== 4. 时间与定时器模块 ==========================
// 时间类型枚举
enum TimeType
{
        yer = 0,// 年份
        mon = 1,// 月份(1-12)
        dat = 2,// 日期(1-31)
        hor = 3,// 小时(0-23)
        mit = 4,// 分钟(0-59)
        sec = 5,// 秒(0-59)
        mst = 6   // 毫秒(0-999)
};

// 获取指定类型的时间(支持枚举参数)
int Gettime(TimeType x)
{
        time_t now = time(nullptr);
        tm *localTime = localtime(&amp;now);
       
        switch (x)
        {
                case yer: return 1900 + localTime-&gt;tm_year;
                case mon: return 1 + localTime-&gt;tm_mon;
                case dat: return localTime-&gt;tm_mday;
                case hor: return localTime-&gt;tm_hour;
                case mit: return localTime-&gt;tm_min;
                case sec: return localTime-&gt;tm_sec;
                case mst:
                {
                        struct timeval tv;
                        gettimeofday(&amp;tv, nullptr);
                        return tv.tv_usec / 1000; // 微秒转毫秒
                }
                default: return -1;
        }
}

// 获取指定类型的时间(支持字符串参数)
int Gettime(const string&amp; x)
{
        if (x == "year") return Gettime(yer);
        if (x == "mon")return Gettime(mon);
        if (x == "dat")return Gettime(dat);
        if (x == "hor")return Gettime(hor);
        if (x == "mit")return Gettime(mit);
        if (x == "sec")return Gettime(sec);
        if (x == "mst")return Gettime(mst);
        return -1;
}

// 高精度定时器
struct Timer
{
private:
        using Clock = chrono::high_resolution_clock;
        using TimePoint = chrono::time_point&lt;Clock&gt;;
       
        TimePoint start_;
        TimePoint pause_;
        bool isRunning_;
        chrono::duration&lt;double&gt; elapsed_;
       
public:
        Timer() : isRunning_(false), elapsed_(0) {}
       
        // 开始计时
        void starttick()
        {
                if (!isRunning_)
                {
                        start_ = Clock::now();
                        isRunning_ = true;
                }
        }
       
        // 暂停计时
        void pausetick()
        {
                if (isRunning_)
                {
                        pause_ = Clock::now();
                        elapsed_ += pause_ - start_;
                        isRunning_ = false;
                }
        }
       
        // 重置计时
        void resettick()
        {
                isRunning_ = false;
                elapsed_ = chrono::duration&lt;double&gt;(0);
        }
       
        // 获取已流逝时间(秒)
        double timesec() const
        {
                if (isRunning_)
                {
                        auto now = Clock::now();
                        return (elapsed_ + (now - start_)).count();
                }
                return elapsed_.count();
        }
       
        // 获取已流逝时间(毫秒)
        double timemst() const
        {
                return timesec() * 1000.0;
        }
};

// 延迟函数(毫秒,高精度)
void msSleep(int milliseconds)
{
        this_thread::sleep_for(chrono::milliseconds(milliseconds));
}

// 获取当前时间戳(秒级)
time_t time_now()
{
        return time(nullptr);
}

// 获取当前时间戳(毫秒级)
long long getms()
{
        struct timeval tv;
        gettimeofday(&amp;tv, nullptr);
        return (long long)tv.tv_sec * 1000 + tv.tv_usec / 1000;
}

// ========================== 5. 数据加密与编码模块 ==========================
// XOR字符串加解密(密钥循环复用)
string xorpass(const string &amp;str, const string &amp;key)
{
        if (key.empty()) return str;
       
        string result = str;
        size_t keyLen = key.size();
        for (size_t i = 0; i &lt; result.size(); ++i)
        {
                result ^= key;
        }
        return result;
}

// XOR文件加解密(返回加密后内容)
string xorFile(const string&amp; filePath, const string&amp; key)
{
        if (key.empty()) return "";
       
        int fd = open(filePath.c_str(), O_RDONLY | O_BINARY);
        if (fd == -1) return "";
       
        struct stat st;
        fstat(fd, &amp;st);
        size_t fileSize = st.st_size;
        string fileContent(fileSize, 0);
        read(fd, &amp;fileContent, fileSize);
        close(fd);
       
        const size_t keyLen = key.size();
        size_t keyIndex = 0;
        for (auto&amp; c : fileContent)
        {
                c = static_cast&lt;char&gt;(static_cast&lt;uint8_t&gt;(c) ^ static_cast&lt;uint8_t&gt;(key));
                keyIndex = (keyIndex + 1) % keyLen;
        }
       
        return fileContent;
}

// XOR文件加解密(直接写入原文件)
void xortoFile(const string&amp; filePath, const string&amp; key)
{
        if (key.empty()) return;
       
        int fd = open(filePath.c_str(), O_RDWR | O_BINARY);
        if (fd == -1) return;
       
        struct stat st;
        fstat(fd, &amp;st);
        size_t fileSize = st.st_size;
        string fileContent(fileSize, 0);
        read(fd, &amp;fileContent, fileSize);
       
        const size_t keyLen = key.size();
        size_t keyIndex = 0;
        for (auto&amp; c : fileContent)
        {
                c = static_cast&lt;char&gt;(static_cast&lt;uint8_t&gt;(c) ^ static_cast&lt;uint8_t&gt;(key));
                keyIndex = (keyIndex + 1) % keyLen;
        }
       
        lseek(fd, 0, SEEK_SET);
        write(fd, &amp;fileContent, fileSize);
        close(fd);
}

// 凯撒文件加解密(移位加密)
void caesarFile(const string&amp; filePath, int shift)
{
        shift %= 256;
        if (shift &lt; 0) shift += 256;
       
        int fd = open(filePath.c_str(), O_RDWR | O_BINARY);
        if (fd == -1) return;
       
        struct stat st;
        fstat(fd, &amp;st);
        size_t fileSize = st.st_size;
        string fileContent(fileSize, 0);
        read(fd, &amp;fileContent, fileSize);
       
        for (auto&amp; c : fileContent)
        {
                c = static_cast&lt;char&gt;((static_cast&lt;uint8_t&gt;(c) + shift) % 256);
        }
       
        lseek(fd, 0, SEEK_SET);
        write(fd, &amp;fileContent, fileSize);
        close(fd);
}

// 凯撒加密(字符串)
string CEnc(const string&amp; input, int shift)
{
        shift %= 256;
        if (shift &lt; 0) shift += 256;
       
        string result = input;
        for (auto&amp; c : result)
        {
                c = static_cast&lt;char&gt;((static_cast&lt;uint8_t&gt;(c) + shift) % 256);
        }
        return result;
}

// 凯撒解密(字符串)
string CDec(const string&amp; input, int shift)
{
        shift %= 256;
        if (shift &lt; 0) shift += 256;
        return CEnc(input, 256 - shift);
}

// 文件凯撒加密
void FileCEnc(const string&amp; filePath, int shift)
{
        caesarFile(filePath, shift);
}

// 文件凯撒解密
void FileCDec(const string&amp; filePath, int shift)
{
        caesarFile(filePath, 256 - (shift % 256));
}

// Base64编码
string base64up(const string &amp;str, const string &amp;base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
{
        string result;
        int val = 0, valBits = 0;
       
        for (unsigned char c : str)
        {
                val = (val &lt;&lt; 8) + c;
                valBits += 8;
                while (valBits &gt;= 6)
                {
                        result += base64Chars[(val &gt;&gt; (valBits - 6)) &amp; 0x3F];
                        valBits -= 6;
                }
        }
       
        if (valBits &gt; 0)
        {
                val &lt;&lt;= (6 - valBits);
                result += base64Chars;
        }
       
        while (result.size() % 4 != 0)
        {
                result += '=';
        }
       
        return result;
}

// Base64解码
string base64dec(const string &amp;str, const string base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
{
        string result;
        vector&lt;int&gt; val(4, -1);
       
        for (size_t i = 0; i &lt; str.size(); ++i)
        {
                char c = str;
                if (c == '=') break;
               
                size_t pos = base64Chars.find(c);
                if (pos == string::npos) continue;
               
                val = pos;
                if (i % 4 == 3)
                {
                        result += (val &lt;&lt; 2) + ((val &gt;&gt; 4) &amp; 0x3);
                        if (val != -1)
                        {
                                result += ((val &lt;&lt; 4) &amp; 0xF0) + ((val &gt;&gt; 2) &amp; 0xF);
                        }
                        if (val != -1)
                        {
                                result += ((val &lt;&lt; 6) &amp; 0xC0) + val;
                        }
                        val.assign(4, -1);
                }
        }
       
        return result;
}

// ========================== 6. 数学计算模块 ==========================
#ifndef _NOMATH_
#define _NOMATH_

// 数学常量(高精度)
constexpr double PI = 3.14159265358979323846264338327950288419716939937510582097494459;
constexpr double E = 2.718281828459045235360287471352662497757247093699959574966967628;
constexpr double SQRT2 = 1.414213562373095048801688724209698078569671875376948073176679738;
constexpr double DEG_TO_RAD = PI / 180.0;// 角度转弧度系数
constexpr double RAD_TO_DEG = 180.0 / PI;// 弧度转角度系数

// 角度转弧度
inline double toRadians(double degrees)
{
        return degrees * DEG_TO_RAD;
}

// 弧度转角度
inline double toDegrees(double radians)
{
        return radians * RAD_TO_DEG;
}

// 计算阶乘(n&lt;0返回-1,溢出返回-1)
inline long long fac(int n)
{
        if (n &lt; 0) return -1;
        if (n == 0 || n == 1) return 1;
       
        long long result = 1;
        for (int i = 2; i &lt;= n; ++i)
        {
                if (result &gt; LLONG_MAX / i)// 防止溢出
                        return -1;
                result *= i;
        }
        return result;
}

// 快速幂(支持负指数)
double qpow(double base, int exponent)
{
        if (exponent == 0) return 1.0;
        if (base == 0.0) return 0.0;
       
        bool isNegative = exponent &lt; 0;
        unsigned int absExponent = static_cast&lt;unsigned int&gt;(isNegative ? -exponent : exponent);
       
        double result = 1.0;
        double current = base;
        while (absExponent &gt; 0)
        {
                if (absExponent % 2 == 1)
                        result *= current;
                current *= current;   
                absExponent /= 2;      
        }
       
        return isNegative ? 1.0 / result : result;
}

// 排列数计算(A(a,b) = a!/(a-b)!,非法输入返回-1)
long long A(int a, int b)
{
        if (a &lt; 0 || b &lt; 0 || a &lt; b) return -1;
        if (b == 0) return 1;
       
        long long result = 1;
        for (int i = 0; i &lt; b; ++i)
        {
                if (result &gt; LLONG_MAX / (a - i))// 防止溢出
                        return -1;
                result *= (a - i);
        }
        return result;
}

// 组合数计算(C(a,b) = a!/(b!(a-b)!),非法输入返回-1)
long long C(int a, int b)
{
        if (a &lt; 0 || b &lt; 0 || a &lt; b) return -1;
        if (b == 0 || a == b) return 1;
       
        // 优化:C(a,b) = C(a,a-b),取较小值减少计算
        b = min(b, a - b);
        long long result = 1;
        for (int i = 1; i &lt;= b; ++i)
        {
                // 防止溢出:先乘后除(确保整除)
                if (result &gt; LLONG_MAX / (a - b + i))
                        return -1;
                result = result * (a - b + i) / i;
        }
        return result;
}

// 判断素数(优化版:遍历至sqrt(x))
bool isHe(int x)
{
        if (x &lt;= 1) return false;
        if (x == 2 || x == 3) return true;
        if (x % 2 == 0 || x % 3 == 0) return false;
       
        for (int i = 5; i * i &lt;= x; i += 6)
        {
                if (x % i == 0 || x % (i + 2) == 0)
                        return false;
        }
        return true;
}

#endif // _NOMATH_

// ========================== 7. 字符串处理模块 ==========================
// 字符串转为全小写
void lowerstring(string &amp;s)
{
        for (auto&amp; c : s)
        {
                if (c &gt;= 'A' &amp;&amp; c &lt;= 'Z')
                        c += ('a' - 'A');
        }
}

// 字符串转为全大写
void uperstring(string &amp;s)
{
        for (auto&amp; c : s)
        {
                if (c &gt;= 'a' &amp;&amp; c &lt;= 'z')
                        c -= ('a' - 'A');
        }
}

// 字符串首字母大写,其余小写
void Testsuper(string &amp;s)
{
        if (s.empty()) return;
       
        s = toupper(s);
        for (size_t i = 1; i &lt; s.size(); ++i)
        {
                s = tolower(s);
        }
}

// 清除输入缓冲区
void flushed()
{
        cin.ignore(numeric_limits&lt;streamsize&gt;::max(), '\n');
        cin.clear();
}

// 检查字符串是否为数字(支持整数和小数,可带正负号)
bool isNumber(const string&amp; str)
{
        if (str.empty()) return false;
       
        size_t start = 0;
        if (str == '+' || str == '-')
                start = 1;
       
        bool hasDot = false;
        for (size_t i = start; i &lt; str.size(); ++i)
        {
                if (str == '.')
                {
                        if (hasDot) return false;// 只能有一个小数点
                        hasDot = true;
                }
                else if (!isdigit(str))
                {
                        return false;
                }
        }
       
        // 避免单独的符号或小数点(如"+"、"."、"-.")
        return (start &lt; str.size()) &amp;&amp; !(start == 1 &amp;&amp; str.size() == 1) &amp;&amp; !(hasDot &amp;&amp; start == str.size() - 1);
}

// 任意类型转为字符串(基于stringstream)
template &lt;typename to_string_T&gt;
string tostring(to_string_T k)
{
        stringstream ans;
        ans &lt;&lt; k;
        return ans.str();
}

// ========================== 8. 随机数模块 ==========================
// 生成指定区间整数随机数()
int rd(int a, int b)
{
        if (a &gt; b) swap(a, b);
        // 基于当前时间初始化随机种子(避免多次调用导致重复)
        static bool seeded = false;
        if (!seeded)
        {
                srand(static_cast&lt;unsigned int&gt;(time(nullptr)) ^ getpid());
                seeded = true;
        }
        return a + (rand() % (b - a + 1));
}

// 生成指定区间浮点数随机数()
double random(double min, double max)
{
        if (min &gt; max) swap(min, max);
        static bool seeded = false;
        if (!seeded)
        {
                srand(static_cast&lt;unsigned int&gt;(time(nullptr)) ^ getpid());
                seeded = true;
        }
        return min + (max - min) * (static_cast&lt;double&gt;(rand()) / RAND_MAX);
}

// 生成指定长度的随机字符串(包含数字和大小写字母)
string randS(int length)
{
        if (length &lt;= 0) return "";
       
        const string chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
        string result;
        result.reserve(length);
       
        static bool seeded = false;
        if (!seeded)
        {
                srand(static_cast&lt;unsigned int&gt;(time(nullptr)) ^ getpid());
                seeded = true;
        }
       
        for (int i = 0; i &lt; length; ++i)
        {
                result += chars;
        }
        return result;
}

// ========================== 9. 日志模块 ==========================
struct logger
{
        Save rep;
        enum error_type
        {
                error = 0,   // 错误
                info = 1,    // 信息
                warn = 2,    // 警告
                debug = 3    // 调试
        };
       
        // 初始化日志文件(覆盖原有内容)
        void reset_logger(const string&amp; path)
        {
                rep.setpt(path);
                rep.save_nol();
                if (rep.errorlevel != 1000)
                {
                        rep.save_o &lt;&lt; "[" &lt;&lt; Gettime(yer) &lt;&lt; "/" &lt;&lt; Gettime(mon) &lt;&lt; "/" &lt;&lt; Gettime(dat)
                        &lt;&lt; "-" &lt;&lt; Gettime(hor) &lt;&lt; ":" &lt;&lt; Gettime(mit) &lt;&lt; ":" &lt;&lt; Gettime(sec) &lt;&lt; "] "
                        &lt;&lt; "Logger initialized" &lt;&lt; endl;
                }
        }
       
        // 写入日志
        void report(const string&amp; s, error_type tp)
        {
                if (!rep.save_o.good()) return;
               
                // 时间戳(精确到毫秒)
                rep.save_o &lt;&lt; "[" &lt;&lt; Gettime(hor) &lt;&lt; ":" &lt;&lt; Gettime(mit) &lt;&lt; ":" &lt;&lt; Gettime(sec)
                &lt;&lt; "(" &lt;&lt; Gettime(mst) &lt;&lt; ")] ";
               
                // 日志类型
                switch (tp)
                {
                        case error: rep.save_o &lt;&lt; "{type=error} "; break;
                        case info:rep.save_o &lt;&lt; "{type=info} ";break;
                        case warn:rep.save_o &lt;&lt; "{type=warn} ";break;
                        case debug: rep.save_o &lt;&lt; "{type=debug} "; break;
                        default:    rep.save_o &lt;&lt; "{type=unknow} ";
                }
               
                // 日志内容
                rep.save_o &lt;&lt; s &lt;&lt; endl;
                rep.save_o.flush();// 强制刷新缓冲区
        }
       
        // 关闭日志文件
        void stop()
        {
                if (rep.save_o.good())
                {
                        rep.save_o &lt;&lt; "[" &lt;&lt; Gettime(hor) &lt;&lt; ":" &lt;&lt; Gettime(mit) &lt;&lt; ":" &lt;&lt; Gettime(sec)
                        &lt;&lt; "] Logger stopped" &lt;&lt; endl;
                }
                rep.save_stop();
        }
};

// ========================== 10. 系统操作与辅助模块 ==========================
// 执行系统命令
void sys(const string&amp; cmd)
{
        system(cmd.c_str());
}

// 无提示暂停(等待按键)
void no_pause()
{
        cout &lt;&lt; "\033[?25h"; // 显示光标
        cout &lt;&lt; "Press any key to continue...";
        flushed();
        getchar();
        cout &lt;&lt; "\033[?25l"; // 隐藏光标
}

// 标准暂停(带提示)
void pause()
{
        system("read -n 1 -s -r -p \"Press any key to continue...\"");
        cout &lt;&lt; endl;
}

// 类型转换快捷宏
#define to_int(x) stoi(x)
#define to_long(x) stol(x)
#define to_double(x) stod(x)
#define to_str(x) tostring(x)
#define sleep(ms) msSleep(ms)

// 进程退出(带提示)
int ext(int num)
{
        cout &lt;&lt; " Process exited with return value " &lt;&lt; num &lt;&lt; endl;
        exit(num);
        return num;
}

// 内存单位转换结构体
struct memory
{
        long long bytes;
       
        double toB()    { return static_cast&lt;double&gt;(bytes); }
        double toKB()   { return bytes / 1024.0; }
        double toMB()   { return bytes / (1024.0 * 1024.0); }
        double toGB()   { return bytes / (1024.0 * 1024.0 * 1024.0); }
        double toTB()   { return bytes / (1024.0 * 1024.0 * 1024.0 * 1024.0); }
        double toPB()   { return bytes / (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0); }
};

// 内存单位转换全局函数
double rtoB(int bytes)    { return static_cast&lt;double&gt;(bytes); }
double rtoKB(int bytes)   { return bytes / 1024.0; }
double rtoMB(int bytes)   { return bytes / (1024.0 * 1024.0); }
double rtoGB(int bytes)   { return bytes / (1024.0 * 1024.0 * 1024.0); }
double rtoTB(int bytes)   { return bytes / (1024.0 * 1024.0 * 1024.0 * 1024.0); }
double rtoPB(int bytes)   { return bytes / (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0); }

// 按字符延迟输出字符串
void say(const string&amp; s, int t)
{
        if (t &lt; 0) return;
        for (char c : s)
        {
                cout &lt;&lt; c &lt;&lt; flush;
                msSleep(t);
        }
}

// 头文件信息
void jtbgunix_h_about()
{
        cout &lt;&lt; "jtbgunix.h\n";
        cout &lt;&lt; "Written by @jiaotangbinggan\n";
        cout &lt;&lt; "Process started with 2025/10/4\n";
        cout &lt;&lt; "Version: " &lt;&lt; _JTBG_UNIX_VERSION &lt;&lt; "\n";
        cout &lt;&lt; "License: " &lt;&lt; _JTBG_LICENSE &lt;&lt; "\n";
        cout &lt;&lt; "Contact:\n";
        cout &lt;&lt; "Luogu: luogu-1497734\n";
        cout &lt;&lt; "Email: 197474286@qq.com, guitu1125@yeah.net\n";
        cout &lt;&lt; "This file hash: none\n";
}

// 关于信息快捷宏
#define about() jtbgunix_h_about()

#endif // _JTBG_UNIX_H_
</code></pre>
</details>

</div>
<div id="MySignature" role="contentinfo">
    <p>本文来自博客园,作者:,转载请注明原文链接:https://www.cnblogs.com/pcworld/p/-/h</p>
<p>最新公告:www.cnblogs.com/pcworld/p/-/error</p><br><br>
来源:https://www.cnblogs.com/pcworld/p/-/h
頁: [1]
查看完整版本: 焦糖饼干头文件c++最新同步