Logo syex_guohoupei的博客

博客

标签
暂无

关于ljxx_chentinghe

2024-07-11 15:02:18 By syex_guohoupei

ljxx_chentinghe此人脑子有问题 祝他事事不顺利,脑子进水,天天去医院!!!

新博客

2024-06-12 19:31:02 By syex_guohoupei

暴力出奇迹,骗分过样例,数学先打表,DP看运气,枚举TLE,贪心还CE。

新博客

2024-05-15 20:20:26 By syex_guohoupei

undef UNICODE

undef _UNICODE

include

include

include

include

include

include

include

include

include

using namespace std; namespace _game {

//常量
const long long ESC=27,
                Enter=13,
                Tab=9,
                Shang=38,
                Xia=40,
                Zuo=37,
                You=39,
                Kong=' ',
                z_sb=VK_LBUTTON,
                y_sb=VK_RBUTTON,
                Shift=VK_SHIFT,
                z_Shift=VK_LSHIFT,
                y_Shift=VK_RSHIFT,
                Ctrl=VK_CONTROL,
                z_Ctrl=VK_LCONTROL,
                y_Ctrl=VK_RCONTROL,
                Alt=VK_MENU,
                z_Alt=VK_LMENU,
                y_Alt=VK_RMENU,
                A='A',
                B='B',
                C='C',
                D='D',
                E='E',
                F='F',
                G='G',
                H='H',
                I='I',
                J='J',
                K='K',
                L='L',
                M='M',
                N='N',
                O='O',
                P='P',
                Q='Q',
                R='R',
                S='S',
                T='T',
                U='U',
                V='V',
                W='W',
                X='X',
                Y='Y',
                Z='Z';

//结构体
struct cdhs//存档结构体
{
    void out(int n, string name)//输出存档
    {
        ofstream cd(&name[0]);
        cd << n;
        return;
    }
    void out(long long n, string name)
    {
        ofstream cd(&name[0]);
        cd << n;
        return;
    }
    void out(bool n, string name)
    {
        ofstream cd(&name[0]);
        cd << n;
        return;
    }
    void out(char n, string name)
    {
        ofstream cd(&name[0]);
        cd << n;
        return;
    }
    void out(string n, string name)
    {
        ofstream cd(&name[0]);
        cd << n;
        return;
    }//重载
    void in(int& n, string name)//读入存档
    {
        ifstream cd(&name[0]);
        cd >> n;
        return;
    }
    void in(long long& n, string name)
    {
        ifstream cd(&name[0]);
        cd >> n;
        return;
    }
    void in(bool& n, string name)
    {
        ifstream cd(&name[0]);
        cd >> n;
        return;
    }
    void in(char& n, string name)
    {
        ifstream cd(&name[0]);
        cd >> n;
        return;
    }
    void in(string& n, string name)
    {
        ifstream cd(&name[0]);
        cd >> n;
        return;
    }//重载 
};
struct hl//行列
{
    long long h,l;
};

//函数
bool axj(long long key)
{
    return (GetKeyState(key)<0)?(true):(false);
}
void bout(string n, long long s=50,bool f=0,char key=13)//输出
{
    for (long long i = 0; i < n.size(); i++)
    {
        if (f&&GetKeyState(key)<0)
        {
            cout<<n.substr(i,n.size());
            return ;
        }
        cout << n[i];
        Sleep(s);
    }
    return;
}
void ckbb()//查看当前b_game.h库版本信息
{
    system("cls");
    cout << "库名:b_game.h\n";
    cout << "类型:拓展库\n";
    cout << "版本号:2.0.1\n";
    return;
}
void gs(long long h, long long l, string z)//格式
{
    for (long long i = 1; i <= h; i++)
        cout << "\n";
    for (long long i = 1; i <= l; i++)
        cout << " ";
    cout << z;
    return;
}
hl sbwz(bool x=1,bool n=1)//鼠标位置
{
    HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    HWND h=GetForegroundWindow();
    CONSOLE_FONT_INFO consoleCurrentFont;
    hl hl;
    POINT p;
    if(x)
    {
        GetCursorPos(&p);
        ScreenToClient(h,&p);
    }
    else
    {
        GetCursorPos(&p);
    }
    if(n)
    {
        GetCurrentConsoleFont(hOutput, FALSE, &consoleCurrentFont);
        p.x/=consoleCurrentFont.dwFontSize.X;
        p.y/=consoleCurrentFont.dwFontSize.Y;
    }
    hl.h=p.y+1;
    hl.l=p.x+1;
    return hl;
}
void yanse(int n)//颜色
{
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), n);
    return;
}
void ycbj()//移除快速编辑模式
{
    HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
    DWORD mode;
    GetConsoleMode(hStdin, &mode);
    mode&=~ENABLE_QUICK_EDIT_MODE;
    SetConsoleMode(hStdin, mode);
    return ;
}
void ycgb()//隐藏光标
{
    CONSOLE_CURSOR_INFO cursor;
    cursor.bVisible = FALSE;
    cursor.dwSize = sizeof(cursor);
    HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorInfo(handle, &cursor);
    return;
}
void ydgb(long long h, long long l)//移动光标
{
    COORD pos = { l-1,h-1 };
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(hOut, pos);
    return;
}

} using namespace _game; using std::cout; using std::cin; const long long dts = 9; long long wj1x, wj1y, wj2x, wj2y, wj3x, wj3y, wj4x, wj4y, cs = 0, dtbh, sy, runs, cgjd = 1, y_1x, y_1y, y_2x, y_2y, y_3x, y_3y, y_4x, y_4y; cdhs cddx; bool f = 1, t1 = 1, t2 = 1, t3 = 1, t4 = 1, cxjs = 1, hyflag = 1; long long csx[dts + 1] = { 0, 18, 18, 18, 14, 1, 3, 1, 3, 18 }; long long csy[dts + 1] = { 0, 1, 1, 1, 1, 1, 1, 1, 37, 1 }; string dtm[dts + 1] = { "空地图", "第二难的", "蹦床天地", "信仰之爬", "舒坦人心", "一路平坦", "小心虚空", "转来转去", "一上一下", "一路顺风" }; string dt[dts + 1][21] = { { " ",// " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", }, { " ",// " $", " = ", " = ", " = ", " = ", " = ", " = ", " ===== = ", " ^ = - ", " = = ", " ^^^^^^^--- ^ ^= ", " = ", " ^ -= - ", " = ", " ^^^^^^^^^--- ^ ^= ", " = ", " ^ -= - ", " = = = ", " ==- ==== ^ ==========-------- =================-= ", " ", }, { " ",// " ", " ", " ", " ", " ", " ", " ", " ", " ------- ", " = ", " -- ------- = > = ", " -- = = ^ = ", " -- < = = > = ", " -- < < = = ^ -------- ===$== ", " - -- < < < = = > ", " < -- < < < < = = ^ ", " < < < < < < = = > ", " = < < < < < = = ^ ", " ---==--------------------------------------------- --------- ", " ", }, { " ",// " ", " $ ", " ====== ", " == <> = ", " < = ", " < ============================= = ", " < = ", " < = ", " = ", " -== > > > > ========= = ", " = = = ", " ====== = = ", " = = ", " ==---- > > > = = ", " = = = ", " == ==== ", " = ", " == ", " = ======-", " ", }, { " ",// " ", " ======================================================================== ", " $", " ========================= === === ================================", " = ", " --------= ", " -= =------------------------------ ---------------------------------", " ", " - ", " == ====================================================================== =", " ========================================================================= =", " ", " ", " ", " ---------------------------------------------------------------------------", " ", " <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> <><>", " ", " ===========================================================================", " ", }, { " ",// " < ", " < ", " < ", " < ", " < ", " < --- ", " < == = ", " < < < < ", " < == < --- < ", " < === = < ", " < = < ", " < = < ", " < === = < ", " < = ==== <=====-", " < === = --- ", " < = ------ =====--- $", " = ", " =====---------=============================================================", " ", " " }, { " == == == == ",// " == == == == ", " == == == == ", " == == == == ", " == == == == = = = = = ", " == == == == = = = = ", " == == == == = ", " == == == == ", " == == == == ============================= ", " == == == = = ", " == == == -== = = ", " == == = == = ", " == == == --== = = ", " ============ = = ", " ======= =======---== = = ", " ======= == == = ", " ======= == == == = ========== === ", " ======= == == = = ==$=== ", " ======= == == == = = === ", " ======= == == ", " ", }, { " ",// " < =", " < < =", " < < > =", " < =---= ==-==================== =", " < = = = = =", " < = = = = = ==-================== =", " < =- == = $= = = = =", " < = = = = = = - =", " < = -= ======-- = == = -==", " < = = = ====== = = ==-= === =", " < =- = ==-----=======- = = - =", " < = ==== = = == === =", " < = --======================--= = === == =", " < = = = == =", " < = =-============================= = = =", " < => ==== =", " ==> =-=", " ================--==================================================---- =", " =", " =" }, { " ",// " > < = = ", " > < = = ", " = > < = = = ", " ==== = > === < = == = ", " == > = == = === = ", " = = < < =$ = ", " = = =============== < = === ", " ==== = == =-========= = ", " = = ======== = ============= = ", " = = ==== === <= = ", " = =================== > == =============--= ", " = ==== == ", " ==== = == == ", " = = === == ", " = = === == ", " ==== === = === == ", " = ====== ==== ", " ========== ======= ", " ", " " }, { " = < < ",// " = < < ", " = < < ", " = < < ", " = < < ", " < = <> < < ", " ====== < = <> < < ", " < = =--= =--= <> = < <-- ", " < = <> < < ", " < = <> < < --", " < = <> < < ", " --- < = =--= <> = < <-- ", " = < = <> < < ", " = < = <> < < --", " = < = <> < < ", " ====== < = <> = < <-- ", " --- < = -- <> ", " < < <> --", " $", " ===========================================================================", " ", } }; //基础函数 void csh() { f = 1, t1 = 1, t2 = 1, t3 = 1, t4 = 1; cs = 0; return; } void gb() { CONSOLE_CURSOR_INFO cursor; cursor.bVisible = FALSE; cursor.dwSize = sizeof(cursor); HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorInfo(handle, &cursor); return; } void out(); void in(); void lx(); void bd(); void gx(); void yl(); //页面函数 void zym(); void yxym(); void smym(); void szsmym(); void wpsmym(); void yxjqym(); void yxbbsm(); //模式函数 void youxi(); void suij(); void cg(); int main() { system("mode con cols=76 lines=20"); system("title 跑酷 Plus 1.3"); cout << "加载中..."; srand(time(0)); yanse(246); ycbj(); gb(); hyflag = 1; cddx.in(cgjd, "game.bin"); system("cls"); while (cxjs) { zym(); system("cls"); } cddx.out(cgjd, "game.bin"); return 0; } void zym() { yanse(246); char s; system("cls"); gs(5, 32, "跑酷"); gs(2, 0, ""); gs(1, 30, "退出"); gs(2, 30, "开始游戏"); gs(2, 30, "游戏说明"); gs(2, 30, "游戏存档"); // if (hyflag) // { // MessageBox(0, "欢迎来到跑酷\n\n制作:饼干", "系统", MB_OK); // hyflag = 0; // } while (1) { long long h = sbwz().h, l = sbwz().l; if (h == 9 && 31 <= l && l <= 34)// { if (axj(z_sb)) { s = '0'; break; } else { ydgb(9, 34); cout << "\b\b\b"; yanse(7); cout << "退出"; } } else { ydgb(9, 34); cout << "\b\b\b"; yanse(246); cout << "退出"; } if (h == 11 && 31 <= l && l <= 38)// { if (axj(z_sb)) { s = '1'; break; } else { ydgb(11, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "开始游戏"; } } else { ydgb(11, 38); cout << "\b\b\b\b\b\b\b"; yanse(246); cout << "开始游戏"; } if (h == 13 && 31 <= l && l <= 38)// { if (axj(z_sb)) { s = '2'; break; } else { ydgb(13, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "游戏说明"; } } else { ydgb(13, 38); cout << "\b\b\b\b\b\b\b"; yanse(246); cout << "游戏说明"; } if (h == 15 && 31 <= l && l <= 38) { if (axj(z_sb)) { s = '3'; break; } else { ydgb(15, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "游戏存档"; } } else { ydgb(15, 38); cout << "\b\b\b\b\b\b\b"; yanse(246); cout << "游戏存档"; } } Sleep(150); switch (s) { case '0': // if (MessageBox(0, "确定退出?", "系统", MB_YESNO) == IDYES) // { cxjs = 0; MessageBox(0, "再见!\n\n制作:饼干\n二创:3Zinc", "系统", MB_OK); return; // } // else // { // yanse(246); // system("cls"); // } break; case '1': yxym(); break; case '2': smym(); break; case '3': cddx.out(cgjd, "game.bin"); // MessageBox(0, "存档成功", "系统", MB_OK); break; } return; } void yxym() { yanse(246); char s; system("cls"); while (1) { gs(8, 30, "退出"); gs(2, 30, "单人模式"); gs(1, 30, "双人模式"); gs(1, 30, "三人模式"); gs(1, 30, "四人模式"); while (1) { long long h = sbwz().h, l = sbwz().l; if (h == 9 && 31 <= l && l <= 34)// { if (axj(z_sb)) { s = '0'; break; } else { ydgb(9, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "退出"; } } else { ydgb(9, 38); cout << "\b\b\b\b\b\b\b"; yanse(246); cout << "退出"; } if (h == 11 && 31 <= l && l <= 38)// { if (axj(z_sb)) { s = '1'; break; } else { ydgb(11, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "单人模式"; } } else { ydgb(11, 38); cout << "\b\b\b\b\b\b\b"; yanse(246); cout << "单人模式"; } if (h == 12 && 31 <= l && l <= 38)// { if (axj(z_sb)) { s = '2'; break; } else { ydgb(12, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "双人模式"; } } else { ydgb(12, 38); cout << "\b\b\b\b\b\b\b"; yanse(246); cout << "双人模式"; } if (h == 13 && 31 <= l && l <= 38)// { if (axj(z_sb)) { s = '3'; break; } else { ydgb(13, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "三人模式"; } } else { ydgb(13, 38); cout << "\b\b\b\b\b\b\b"; yanse(246); cout << "三人模式"; } if (h == 14 && 31 <= l && l <= 38)// { if (axj(z_sb)) { s = '4'; break; } else { ydgb(14, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "四人模式"; } } else { ydgb(14, 38); cout << "\b\b\b\b\b\b\b"; yanse(246); cout << "四人模式"; } } Sleep(150); switch (s) { case '0': return; case '1': runs = 1; break; case '2': runs = 2; break; case '3': runs = 3; break; case '4': runs = 4; break; } youxi(); } return; } void out() { for (long long i = 1; i <= 19; i++) { for (long long j = 1; j <= 75; j++) { if (i == wj1x && j == wj1y) { yanse(11); cout << "*"; } else if (i == wj2x && j == wj2y && runs >= 2) { yanse(12); cout << "+"; } else if (i == wj3x && j == wj3y && runs >= 3) { yanse(14); cout << "!"; } else if (i == wj4x && j == wj4y && runs >= 4) { yanse(10); cout << "#"; } else if (dt[dtbh][i][j] == '$') { yanse(7); cout << "$"; } else { yanse(246); cout << dt[dtbh][i][j]; } } cout << endl; } return; } void in() { yanse(246); char s; if (GetKeyState('P') < 0) { system("cls"); for (long long i = 1; i <= 6; i++) { cout << "\n"; } for (long long i = 1; i <= 30; i++) cout << " "; cout << "暂停中\n\n"; for (long long i = 1; i <= 30; i++) cout << " "; cout << "退出\n"; for (long long i = 1; i <= 30; i++) cout << " "; cout << "返回\n"; while (1) { long long h = sbwz().h, l = sbwz().l; if (h == 9 && 31 <= l && l <= 34)// { if (axj(z_sb)) { s = '0'; break; } else { ydgb(9, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "退出"; } } else { ydgb(9, 38); cout << "\b\b\b\b\b\b\b"; yanse(246); cout << "退出"; } if (h == 10 && 31 <= l && l <= 34)// { if (axj(z_sb)) { s = '1'; break; } else { ydgb(10, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "返回"; } } else { ydgb(10, 38); cout << "\b\b\b\b\b\b\b"; yanse(246); cout << "返回"; } } Sleep(150); switch (s) { case '0': f = 0; sy = 0; yanse(246); return; case '1': yanse(246); system("cls"); out(); system("cls"); out(); break; } } if (GetKeyState(38) < 0 && (dt[dtbh][wj1x - 1][wj1y] == ' ' || dt[dtbh][wj1x - 1][wj1y] == '$') && wj1x > 1 && t1) { wj1x--; for (long long i = 1; i <= 2; i++) if (dt[dtbh][wj1x - 1][wj1y] == ' ' && wj1x > 1)wj1x--; t1 = 0; } if (GetKeyState(37) < 0 && (dt[dtbh][wj1x][wj1y - 1] == ' ' || dt[dtbh][wj1x][wj1y - 1] == '$') && wj1y - 1 > 0) { wj1y--; } if (GetKeyState(39) < 0 && (dt[dtbh][wj1x][wj1y + 1] == ' ' || dt[dtbh][wj1x][wj1y + 1] == '$') && wj1y - 1 <= 100) { wj1y++; } if (runs >= 2) { if (GetKeyState('W') < 0 && (dt[dtbh][wj2x - 1][wj2y] == ' ' || dt[dtbh][wj2x - 1][wj2y] == '$') && wj2x > 1 && t2) { wj2x--; for (long long i = 1; i <= 2; i++) if (dt[dtbh][wj2x - 1][wj2y] == ' ' && wj2x > 1)wj2x--; t2 = 0; } if (GetKeyState('A') < 0 && (dt[dtbh][wj2x][wj2y - 1] == ' ' || dt[dtbh][wj2x][wj2y - 1] == '$') && wj2y - 1 > 0) { wj2y--; } if (GetKeyState('D') < 0 && (dt[dtbh][wj2x][wj2y + 1] == ' ' || dt[dtbh][wj2x][wj2y + 1] == '$') && wj1y - 1 <= 100) { wj2y++; } } if (runs >= 3) { if (GetKeyState('I') < 0 && (dt[dtbh][wj3x - 1][wj3y] == ' ' || dt[dtbh][wj3x - 1][wj3y] == '$') && wj3x > 1 && t3) { wj3x--; for (long long i = 1; i <= 2; i++) if (dt[dtbh][wj3x - 1][wj3y] == ' ' && wj3x > 1)wj3x--; t3 = 0; } if (GetKeyState('J') < 0 && (dt[dtbh][wj3x][wj3y - 1] == ' ' || dt[dtbh][wj3x][wj3y - 1] == '$') && wj3y - 1 > 0) { wj3y--; } if (GetKeyState('L') < 0 && (dt[dtbh][wj3x][wj3y + 1] == ' ' || dt[dtbh][wj3x][wj3y + 1] == '$') && wj3y - 1 <= 100) { wj3y++; } } if (runs >= 4) { if (GetKeyState(101) < 0 && (dt[dtbh][wj4x - 1][wj4y] == ' ' || dt[dtbh][wj4x - 1][wj4y] == '$') && wj4x > 1 && t4) { wj4x--; for (long long i = 1; i <= 2; i++) if (dt[dtbh][wj4x - 1][wj4y] == ' ' && wj4x > 1)wj4x--; t4 = 0; } if (GetKeyState(97) < 0 && (dt[dtbh][wj4x][wj4y - 1] == ' ' || dt[dtbh][wj4x][wj4y - 1] == '$') && wj4y - 1 > 0) { wj4y--; } if (GetKeyState(99) < 0 && (dt[dtbh][wj4x][wj4y + 1] == ' ' || dt[dtbh][wj4x][wj4y + 1] == '$') && wj4y - 1 <= 100) { wj4y++; } } return; } void lx() { if (dt[dtbh][wj1x + 1][wj1y] == ' ' || dt[dtbh][wj1x + 1][wj1y] == '$')wj1x++; else t1 = 1; if (dt[dtbh][wj2x + 1][wj2y] == ' ' || dt[dtbh][wj2x + 1][wj2y] == '$')wj2x++; else t2 = 1; if (dt[dtbh][wj3x + 1][wj3y] == ' ' || dt[dtbh][wj3x + 1][wj3y] == '$')wj3x++; else t3 = 1; if (dt[dtbh][wj4x + 1][wj4y] == ' ' || dt[dtbh][wj4x + 1][wj4y] == '$')wj4x++; else t4 = 1; return; } void yl() { if (dt[dtbh][wj1x][wj1y] == '$') { f = 0; sy = 1; } if (dt[dtbh][wj2x][wj2y] == '$') { f = 0; sy = 2; } if (dt[dtbh][wj3x][wj3y] == '$') { f = 0; sy = 3; } if (dt[dtbh][wj4x][wj4y] == '$') { f = 0; sy = 4; } return; } void bd() { if (wj1x == 20) { wj1x = csx[dtbh]; wj1y = csy[dtbh]; } if (wj2x == 20) { wj2x = csx[dtbh]; wj2y = csy[dtbh]; } if (wj3x == 20) { wj3x = csx[dtbh]; wj3y = csy[dtbh]; } if (wj4x == 20) { wj4x = csx[dtbh]; wj4y = csy[dtbh]; } if (dt[dtbh][wj1x + 1][wj1y] == '^') { wj1x = csx[dtbh]; wj1y = csy[dtbh]; } if (dt[dtbh][wj2x + 1][wj2y] == '^') { wj2x = csx[dtbh]; wj2y = csy[dtbh]; }// if (dt[dtbh][wj3x + 1][wj3y] == '^') { wj3x = csx[dtbh]; wj3y = csy[dtbh]; } if (dt[dtbh][wj4x + 1][wj4y] == '^') { wj4x = csx[dtbh]; wj4y = csy[dtbh]; }// if (dt[dtbh][wj1x][wj1y + 1] == '<') { wj1x = csx[dtbh]; wj1y = csy[dtbh]; } if (dt[dtbh][wj2x][wj2y + 1] == '<') { wj2x = csx[dtbh]; wj2y = csy[dtbh]; }// if (dt[dtbh][wj3x][wj3y + 1] == '<') { wj3x = csx[dtbh]; wj3y = csy[dtbh]; } if (dt[dtbh][wj4x][wj4y + 1] == '<') { wj4x = csx[dtbh]; wj4y = csy[dtbh]; }// if (dt[dtbh][wj1x][wj1y - 1] == '>') { wj1x = csx[dtbh]; wj1y = csy[dtbh]; } if (dt[dtbh][wj2x][wj2y - 1] == '>') { wj2x = csx[dtbh]; wj2y = csy[dtbh]; }// if (dt[dtbh][wj3x][wj3y - 1] == '>') { wj3x = csx[dtbh]; wj3y = csy[dtbh]; } if (dt[dtbh][wj4x][wj4y - 1] == '>') { wj4x = csx[dtbh]; wj4y = csy[dtbh]; }// if (dt[dtbh][wj1x + 1][wj1y] == '-') { for (long long i = 1; i <= 10 && wj1x > 1; i++) { if (dt[dtbh][wj1x - 1][wj1y] == ' ' || dt[dtbh][wj1x - 1][wj1y] == '$') { wj1x--; } else break; } } if (dt[dtbh][wj2x + 1][wj2y] == '-') { for (long long i = 1; i <= 10 && wj2x > 1; i++) { if (dt[dtbh][wj2x - 1][wj2y] == ' ' || dt[dtbh][wj2x - 1][wj2y] == '$') { wj2x--; } else break; } }// if (dt[dtbh][wj3x + 1][wj3y] == '-') { for (long long i = 1; i <= 10 && wj3x > 1; i++) { if (dt[dtbh][wj3x - 1][wj3y] == ' ' || dt[dtbh][wj3x - 1][wj3y] == '$') { wj3x--; } else break; } } if (dt[dtbh][wj4x + 1][wj4y] == '-') { for (long long i = 1; i <= 10 && wj4x > 1; i++) { if (dt[dtbh][wj4x - 1][wj4y] == ' ' || dt[dtbh][wj4x - 1][wj4y] == '$') { wj4x--; } else break; } } return; } void youxi() { yanse(246); system("cls"); char s; while (1) { for (long long i = 1; i <= 8; i++) cout << "\n"; for (long long i = 1; i <= 30; i++) cout << " "; cout << "退出\n\n"; for (long long i = 1; i <= 30; i++) cout << " "; cout << "随机\n\n"; for (long long i = 1; i <= 30; i++) cout << " "; cout << "闯关\n"; while (1) { long long h = sbwz().h, l = sbwz().l; if (h == 9 && 31 <= l && l <= 34)// { if (axj(z_sb)) { s = '0'; break; } else { ydgb(9, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "退出"; } } else { ydgb(9, 38); cout << "\b\b\b\b\b\b\b"; yanse(246); cout << "退出"; } if (h == 11 && 31 <= l && l <= 34)// { if (axj(z_sb)) { s = '1'; break; } else { ydgb(11, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "随机"; } } else { ydgb(11, 38); cout << "\b\b\b\b\b\b\b"; yanse(246); cout << "随机"; } if (h == 13 && 31 <= l && l <= 34)// { if (axj(z_sb)) { s = '2'; break; } else { ydgb(13, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "闯关"; } } else { ydgb(13, 38); cout << "\b\b\b\b\b\b\b"; yanse(246); cout << "闯关"; } } Sleep(150); switch (s) { case '0': yanse(246); system("cls"); return; case '1': suij(); break; case '2': cg(); break; } system("cls"); } return; } void suij() { char s; while (1) { csh(); dtbh = rand() % dts + 1; wj1x = wj2x = wj3x = wj4x = csx[dtbh]; wj1y = wj2y = wj3y = wj4y = csy[dtbh]; system("cls"); out(); for (long long i = 1; f; i++) { gx(); yanse(246); Sleep(50); in(); yl(); bd(); yl(); if (cs == 1) lx(); yl(); if (cs == 1)cs = -1; cs++; if (i == 1) { system("cls"); out(); } } system("cls"); if (runs >= 2) { if (sy == 0) { system("cls"); return; } if (sy == 1) { yanse(11); system("cls"); cout << "*赢了!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } else if (sy == 2) { yanse(12); system("cls"); cout << "+赢了!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } else if (sy == 3) { yanse(14); system("cls"); cout << "!赢了!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } else if (sy == 4) { yanse(10); system("cls"); cout << "#赢了!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } } else { if (sy == 0) { system("cls"); return; } else { yanse(11); system("cls"); cout << "你赢了!!!"; cout << "\n点击继续"; while (!axj(z_sb)); } } yanse(246); system("cls"); cout << "是否返回?\n"; cout << "返回\n"; cout << "继续"; while (1) { long long h = sbwz().h, l = sbwz().l; if (h == 2 && 1 <= l && l <= 4) { ydgb(2, 1); yanse(7); cout << "返回"; if (axj(z_sb)) { s = 'y'; break; } } else { ydgb(2, 1); yanse(246); cout << "返回"; } if (h == 3 && 1 <= l && l <= 4) { ydgb(3, 1); yanse(7); cout << "继续"; if (axj(z_sb)) { s = 'n'; break; } } else { ydgb(3, 1); yanse(246); cout << "继续"; } } Sleep(150); if (s == 'y') { f = 0; yanse(246); system("cls"); return; } yanse(246); system("cls"); } return; } void gx() { if (dt[dts][y_1x][y_1y] != '$') { yanse(246); ydgb(y_1x, y_1y + 1); cout << '\b' << " "; } if (runs >= 2 && dt[dts][y_2x][y_2y] != '$') { ydgb(y_2x, y_2y + 1); cout << '\b' << " "; } if (runs >= 3 && dt[dts][y_3x][y_3y] != '$') { ydgb(y_3x, y_3y + 1); cout << '\b' << " "; } if (runs >= 4 && dt[dts][y_4x][y_4y] != '$') { ydgb(y_4x, y_4y + 1); cout << '\b' << " "; } if (runs >= 4 && dt[dts][wj4x][wj4y] != '$') { yanse(10); ydgb(wj4x, wj4y + 1); if (dt[dts][y_4x][y_4y] != '$') { cout << '\b'; cout << "#"; } } if (runs >= 3 && dt[dts][wj3x][wj3y] != '$') { yanse(14); ydgb(wj3x, wj3y + 1); if (dt[dts][y_3x][y_3y] != '$') { cout << '\b'; cout << "!"; } } if (runs >= 2 && dt[dts][wj2x][wj2y] != '$') { yanse(12); ydgb(wj2x, wj2y + 1); if (dt[dts][y_2x][y_2y] != '$') { cout << '\b'; cout << "+"; } } if (dt[dts][wj1x][wj1y] != '$') { yanse(11); ydgb(wj1x, wj1y + 1); if (dt[dts][y_1x][y_1y] != '$') { cout << '\b'; cout << "*"; } } y_1x = wj1x, y_1y = wj1y; if (runs >= 2) { y_2x = wj2x, y_2y = wj2y; } if (runs >= 3) { y_3x = wj3x, y_3y = wj3y; } if (runs >= 4) { y_4x = wj4x, y_4y = wj4y; } yanse(246); return; } void cg() { bool flag = 1; char s; system("cls"); while (1) { csh(); while (f) { flag = 1; system("cls"); cout << "退出" << endl; for (long long i = 1; i <= dts; i++) { if (cgjd >= i) { cout << dtm[i]; if (cgjd == i) { cout << "="; } for (long long j = 1; j <= 15 - dtm[i].size() - (cgjd == i); j++) { cout << " "; } } else { cout << "????"; for (long long j = 1; j <= 14 - 7; j++) { cout << " "; } } if (i % 4 == 0) cout << endl; } while (flag) { long long h = sbwz().h, l = sbwz().l; long long da[4] = { 1,16,31,46 }, db[4] = { 8,23,38,53 }; if (h == 1 && 1 <= l && l <= 4) { ydgb(1, 1); yanse(7); cout << "退出"; if (axj(z_sb)) { yanse(246); system("cls"); return; } } else { ydgb(1, 1); yanse(246); cout << "退出"; } for (long long i = 0; i < dts; i++) { if (h == (i / 4) + 2 && da[i % 4] <= l && l <= db[i % 4]) { ydgb((i / 4) + 2, da[i % 4]); yanse(7); if (cgjd < i + 1) cout << "????"; else cout << dtm[i + 1]; if (axj(z_sb)) { s = i + '0' + 1; flag = 0; yanse(246); system("cls"); break; } } else { ydgb((i / 4) + 2, da[i % 4]); yanse(246); if (cgjd < i + 1) cout << "????"; else cout << dtm[i + 1]; } } } Sleep(150); if (s - '0' > cgjd) { system("cls"); cout << "\n你还没有解锁此关卡!\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; cout << "点击继续"; while (!axj(z_sb)); system("cls"); Sleep(150); break; } system("cls"); dtbh = s - '0'; wj1x = wj2x = wj3x = wj4x = csx[dtbh]; wj1y = wj2y = wj3y = wj4y = csy[dtbh]; out(); for (long long i = 1; f; i++) { gx(); yanse(246); Sleep(50); in(); yl(); bd(); yl(); if (cs == 1) lx(); yl(); if (cs == 1)cs = -1; cs++; if (i == 1) { system("cls"); out(); } } system("cls"); if (runs >= 2) { if (sy == 0) { system("cls"); return; } if (sy == 1) { yanse(11); system("cls"); cout << "*赢了!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } else if (sy == 2) { yanse(12); system("cls"); cout << "+赢了!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } else if (sy == 3) { yanse(14); system("cls"); cout << "!赢了!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } else if (sy == 4) { yanse(10); system("cls"); cout << "#赢了!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } } else { if (sy == 0) { system("cls"); break; } else { yanse(11); system("cls"); cout << "你赢了!!!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } } yanse(246); if (cgjd == dtbh) { cgjd++; } system("cls"); } } return; } void smym() { while (1) { yanse(246); char s; system("cls"); cout << "游戏说明:\n"; cout << "退出\n"; cout << "操作说明\n"; cout << "物品说明\n"; cout << "游戏技巧\n"; cout << "版本说明\n"; while (1) { long long h = sbwz().h, l = sbwz().l; if (h == 2 && 1 <= l && l <= 4) { yanse(7); ydgb(2, 1); cout << "退出"; if (axj(z_sb)) { s = '0'; break; } } else { yanse(246); ydgb(2, 1); cout << "退出"; } if (h == 3 && 1 <= l && l <= 8) { yanse(7); ydgb(3, 1); cout << "操作说明"; if (axj(z_sb)) { s = '1'; break; } } else { yanse(246); ydgb(3, 1); cout << "操作说明"; } if (h == 4 && 1 <= l && l <= 8) { yanse(7); ydgb(4, 1); cout << "物品说明"; if (axj(z_sb)) { s = '2'; break; } } else { yanse(246); ydgb(4, 1); cout << "物品说明"; } if (h == 5 && 1 <= l && l <= 8) { yanse(7); ydgb(5, 1); cout << "游戏技巧"; if (axj(z_sb)) { s = '3'; break; } } else { yanse(246); ydgb(5, 1); cout << "游戏技巧"; } if (h == 6 && 1 <= l && l <= 8) { yanse(7); ydgb(6, 1); cout << "版本说明"; if (axj(z_sb)) { s = '4'; break; } } else { yanse(246); ydgb(6, 1); cout << "版本说明"; } } Sleep(150); yanse(246); switch (s) { case '0': system("cls"); return; case '1': szsmym(); break; case '2': wpsmym(); break; case '3': yxjqym(); break; case '4': yxbbsm(); } } return; } void szsmym() { char s; system("cls"); gs(0, 0, "操作说明:"); gs(1, 8, "-------"); gs(0, 6, "-------"); gs(1, 8, "|玩家1|"); gs(0, 6, "|玩家2|"); gs(1, 8, "| ^ |"); gs(0, 6, "| W |"); gs(1, 8, "|< >|"); gs(0, 6, "|A D|"); gs(1, 8, "|移动 |"); gs(0, 6, "|移动 |"); gs(1, 8, "-------"); gs(0, 6, "-------"); gs(1, 0, ""); gs(1, 8, "-------"); gs(0, 6, "-------"); gs(1, 8, "|玩家3|"); gs(0, 6, "|玩家4|"); gs(1, 8, "| I |"); gs(0, 6, "| 5 |"); gs(1, 8, "|J L|"); gs(0, 6, "|1 3|"); gs(1, 8, "|移动 |"); gs(0, 6, "|移动 |"); gs(1, 8, "-------"); gs(0, 6, "-------"); gs(1, 0, ""); gs(1, 4, "功能键:"); gs(1, 8, "P暂停"); cout << "\n\n点击继续"; while (!axj(z_sb)); Sleep(150); system("cls"); return; } void wpsmym() { char s; system("cls"); cout << "* 玩家1\n"; cout << "+ 玩家2\n"; cout << "! 玩家3\n"; cout << "# 玩家3\n"; cout << "= 砖块\n"; cout << "$ 终点\n"; cout << "- 蹦床\n"; cout << "^ 上刺\n"; cout << "< 左刺\n"; cout << "> 右刺\n"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); system("cls"); return; } void yxjqym() { system("cls"); char s; system("cls"); gs(1, 4, "游戏技巧:"); gs(1, 8, "1.延迟起跳:"); gs(1, 12, "如果上方有物品,跳起来会挡住"); gs(1, 12, "可以先走过去,等上方无遮挡物时按跳键"); gs(1, 12, "这样就可以跳的远了"); cout << "\n\n\n\n\n\n\n\n\n\n点击继续"; while (!axj(z_sb)); Sleep(150); system("cls"); return; } void yxbbsm() { system("cls"); cout << "游戏名:跑酷\n"; cout << "游戏版本:Plus 1.3\n"; cout << "游戏作者:喵喵 & 3Zinc\n"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); system("cls"); return; }

新博客

2024-05-15 20:20:06 By syex_guohoupei

undef UNICODE

undef _UNICODE

include

include

include

include

include

include

include

include

include

using namespace std; namespace _game {

//常量
const long long ESC=27,
                Enter=13,
                Tab=9,
                Shang=38,
                Xia=40,
                Zuo=37,
                You=39,
                Kong=' ',
                z_sb=VK_LBUTTON,
                y_sb=VK_RBUTTON,
                Shift=VK_SHIFT,
                z_Shift=VK_LSHIFT,
                y_Shift=VK_RSHIFT,
                Ctrl=VK_CONTROL,
                z_Ctrl=VK_LCONTROL,
                y_Ctrl=VK_RCONTROL,
                Alt=VK_MENU,
                z_Alt=VK_LMENU,
                y_Alt=VK_RMENU,
                A='A',
                B='B',
                C='C',
                D='D',
                E='E',
                F='F',
                G='G',
                H='H',
                I='I',
                J='J',
                K='K',
                L='L',
                M='M',
                N='N',
                O='O',
                P='P',
                Q='Q',
                R='R',
                S='S',
                T='T',
                U='U',
                V='V',
                W='W',
                X='X',
                Y='Y',
                Z='Z';

//结构体
struct cdhs//存档结构体
{
    void out(int n, string name)//输出存档
    {
        ofstream cd(&name[0]);
        cd << n;
        return;
    }
    void out(long long n, string name)
    {
        ofstream cd(&name[0]);
        cd << n;
        return;
    }
    void out(bool n, string name)
    {
        ofstream cd(&name[0]);
        cd << n;
        return;
    }
    void out(char n, string name)
    {
        ofstream cd(&name[0]);
        cd << n;
        return;
    }
    void out(string n, string name)
    {
        ofstream cd(&name[0]);
        cd << n;
        return;
    }//重载
    void in(int& n, string name)//读入存档
    {
        ifstream cd(&name[0]);
        cd >> n;
        return;
    }
    void in(long long& n, string name)
    {
        ifstream cd(&name[0]);
        cd >> n;
        return;
    }
    void in(bool& n, string name)
    {
        ifstream cd(&name[0]);
        cd >> n;
        return;
    }
    void in(char& n, string name)
    {
        ifstream cd(&name[0]);
        cd >> n;
        return;
    }
    void in(string& n, string name)
    {
        ifstream cd(&name[0]);
        cd >> n;
        return;
    }//重载 
};
struct hl//行列
{
    long long h,l;
};

//函数
bool axj(long long key)
{
    return (GetKeyState(key)<0)?(true):(false);
}
void bout(string n, long long s=50,bool f=0,char key=13)//输出
{
    for (long long i = 0; i < n.size(); i++)
    {
        if (f&&GetKeyState(key)<0)
        {
            cout<<n.substr(i,n.size());
            return ;
        }
        cout << n[i];
        Sleep(s);
    }
    return;
}
void ckbb()//查看当前b_game.h库版本信息
{
    system("cls");
    cout << "库名:b_game.h\n";
    cout << "类型:拓展库\n";
    cout << "版本号:2.0.1\n";
    return;
}
void gs(long long h, long long l, string z)//格式
{
    for (long long i = 1; i <= h; i++)
        cout << "\n";
    for (long long i = 1; i <= l; i++)
        cout << " ";
    cout << z;
    return;
}
hl sbwz(bool x=1,bool n=1)//鼠标位置
{
    HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    HWND h=GetForegroundWindow();
    CONSOLE_FONT_INFO consoleCurrentFont;
    hl hl;
    POINT p;
    if(x)
    {
        GetCursorPos(&p);
        ScreenToClient(h,&p);
    }
    else
    {
        GetCursorPos(&p);
    }
    if(n)
    {
        GetCurrentConsoleFont(hOutput, FALSE, &consoleCurrentFont);
        p.x/=consoleCurrentFont.dwFontSize.X;
        p.y/=consoleCurrentFont.dwFontSize.Y;
    }
    hl.h=p.y+1;
    hl.l=p.x+1;
    return hl;
}
void yanse(int n)//颜色
{
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), n);
    return;
}
void ycbj()//移除快速编辑模式
{
    HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
    DWORD mode;
    GetConsoleMode(hStdin, &mode);
    mode&=~ENABLE_QUICK_EDIT_MODE;
    SetConsoleMode(hStdin, mode);
    return ;
}
void ycgb()//隐藏光标
{
    CONSOLE_CURSOR_INFO cursor;
    cursor.bVisible = FALSE;
    cursor.dwSize = sizeof(cursor);
    HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorInfo(handle, &cursor);
    return;
}
void ydgb(long long h, long long l)//移动光标
{
    COORD pos = { l-1,h-1 };
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(hOut, pos);
    return;
}

} using namespace _game; using std::cout; using std::cin; const long long dts = 9; long long wj1x, wj1y, wj2x, wj2y, wj3x, wj3y, wj4x, wj4y, cs = 0, dtbh, sy, runs, cgjd = 1, y_1x, y_1y, y_2x, y_2y, y_3x, y_3y, y_4x, y_4y; cdhs cddx; bool f = 1, t1 = 1, t2 = 1, t3 = 1, t4 = 1, cxjs = 1, hyflag = 1; long long csx[dts + 1] = { 0, 18, 18, 18, 14, 1, 3, 1, 3, 18 }; long long csy[dts + 1] = { 0, 1, 1, 1, 1, 1, 1, 1, 37, 1 }; string dtm[dts + 1] = { "空地图", "第二难的", "蹦床天地", "信仰之爬", "舒坦人心", "一路平坦", "小心虚空", "转来转去", "一上一下", "一路顺风" }; string dt[dts + 1][21] = { { " ",// " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", }, { " ",// " ", " $ = ", " = ", " = ", " = ", " = ", " = ", " ===== = ", " = = - ", " = = ", " ----- = -= ", " = ", " = -= - ", " = ", " -===----- = -= ", " = ", " = -= - ", " = === = ", " ========= ==========--------------- =================-= ", " ", }, { " ",// " ", " ", " ", " ", " ", " ", " ", " ", " ------- ", " = ", " = ------- = = = ", " = = = = = ", " = = = = = = ", " = = = = = = -------- ===$== ", " = = = = = = = ", " = = = = = = = = ", " = = = = = = = = ", " = = = = = = = = ", " -------------------------------------------------- --------- ", " ", }, { " ",// " ", " $ ", " == ====== ", " = <> = ", " = = ", " = ============================= = ", " = = ", " = = ", " = ", " -== > > > > ========= = ", " = = = ", " ====== = = ", " = = ", " ==---- > > > = = ", " = = = ", " == ==== ", " = ", " == ", " = ======-", " ", }, { " ",// " ", " ======================================================================== ", " $", " ========================= === === ================================", " = ", " --------= ", " -= =------------------------------ ---------------------------------", " ", " - ", " == ====================================================================== =", " ========================================================================= =", " ", " ", " ", " ---------------------------------------------------------------------------", " ", " <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> <><>", " ", " ===========================================================================", " ", }, { " ",// " < ", " < ", " < ", " < ", " < ", " < --- ", " < == = ", " < < < < ", " < == < --- < ", " < === = < ", " < = < ", " < = < ", " < === = < ", " < = ==== <=====-", " < === = --- ", " < = ------ =====--- $", " = ", " =====---------=============================================================", " ", " " }, { " == == == == ",// " == == == == ", " == == == == ", " == == == == ", " == == == == = = = = = ", " == == == == = = = = ", " == == == == = ", " == == == == ", " == == == == ============================= ", " == == == = = ", " == == == -== = = ", " == == = == = ", " == == == --== = = ", " ============ = = ", " ======= =======---== = = ", " ======= == == = ", " ======= == == == = ========== === ", " ======= == == = = ==$=== ", " ======= == == == = = === ", " ======= == == ", " ", }, { " ",// " < =", " < < =", " < < > =", " < =---= ==-==================== =", " < = = = = =", " < = = = = = ==-================== =", " < = ==== = $= = = == =", " < = = = = = = =", " < = == ======-- = == = ===", " < = = ====== = = === === =", " < =- = ==-----=======- = = =", " < = ==== = = == =", " < = ========================--= = === =", " < > < = =", " < = =============================== = =", " < => ==== =", " ==> ===", " ================--================================================== =", " =", " =" }, { " ",// " > < = = ", " > < = = ", " = > < = = = ", " ==== = > === < = == = ", " == > = == = === = ", " = = < < =$ = ", " = = =============== < = === ", " ==== = == =-========= = ", " = = ======== = ============= = ", " = = ==== === <= = ", " = =================== > == =============--= ", " = ==== == ", " ==== = == == ", " = = === == ", " = = === == ", " ==== === = === == ", " = ====== ==== ", " ========== ======= ", " ", " " }, { " = < < ",// " = < < ", " = < < ", " = < < ", " = < < ", " < = <> < < ", " ====== < = <> < < ", " < = =--= =--= <> = < <-- ", " < = <> < < ", " < = <> < < --", " < = <> < < ", " --- < = =--= <> = < <-- ", " = < = <> < < ", " = < = <> < < --", " = < = <> < < ", " ====== < = <> = < <-- ", " --- < = -- <> ", " < < <> --", " $", " ===========================================================================", " ", } }; //基础函数 void csh() { f = 1, t1 = 1, t2 = 1, t3 = 1, t4 = 1; cs = 0; return; } void gb() { CONSOLE_CURSOR_INFO cursor; cursor.bVisible = FALSE; cursor.dwSize = sizeof(cursor); HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorInfo(handle, &cursor); return; } void out(); void in(); void lx(); void bd(); void gx(); void yl(); //页面函数 void zym(); void yxym(); void smym(); void szsmym(); void wpsmym(); void yxjqym(); void yxbbsm(); //模式函数 void youxi(); void suij(); void cg(); int main() { system("mode con cols=76 lines=20"); system("title 跑酷 Plus 1.2"); cout << "加载中..."; srand(time(0)); yanse(240); ycbj(); gb(); hyflag = 1; cddx.in(cgjd, "game.bin"); system("cls"); while (cxjs) { zym(); system("cls"); } cddx.out(cgjd, "game.bin"); return 0; } void zym() { yanse(240); char s; system("cls"); gs(5, 32, "跑酷"); gs(2, 0, ""); gs(1, 30, "退出"); gs(2, 30, "开始游戏"); gs(2, 30, "游戏说明"); gs(2, 30, "游戏存档"); // if (hyflag) // { // MessageBox(0, "欢迎来到跑酷\n\n制作:饼干", "系统", MB_OK); // hyflag = 0; // } while (1) { long long h = sbwz().h, l = sbwz().l; if (h == 9 && 31 <= l && l <= 34)// { if (axj(z_sb)) { s = '0'; break; } else { ydgb(9, 34); cout << "\b\b\b"; yanse(7); cout << "退出"; } } else { ydgb(9, 34); cout << "\b\b\b"; yanse(240); cout << "退出"; } if (h == 11 && 31 <= l && l <= 38)// { if (axj(z_sb)) { s = '1'; break; } else { ydgb(11, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "开始游戏"; } } else { ydgb(11, 38); cout << "\b\b\b\b\b\b\b"; yanse(240); cout << "开始游戏"; } if (h == 13 && 31 <= l && l <= 38)// { if (axj(z_sb)) { s = '2'; break; } else { ydgb(13, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "游戏说明"; } } else { ydgb(13, 38); cout << "\b\b\b\b\b\b\b"; yanse(240); cout << "游戏说明"; } if (h == 15 && 31 <= l && l <= 38) { if (axj(z_sb)) { s = '3'; break; } else { ydgb(15, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "游戏存档"; } } else { ydgb(15, 38); cout << "\b\b\b\b\b\b\b"; yanse(240); cout << "游戏存档"; } } Sleep(150); switch (s) { case '0': // if (MessageBox(0, "确定退出?", "系统", MB_YESNO) == IDYES) // { cxjs = 0; MessageBox(0, "再见!\n\n制作:饼干\n二创:3Zinc", "系统", MB_OK); return; // } // else // { // yanse(240); // system("cls"); // } break; case '1': yxym(); break; case '2': smym(); break; case '3': cddx.out(cgjd, "game.bin"); // MessageBox(0, "存档成功", "系统", MB_OK); break; } return; } void yxym() { yanse(240); char s; system("cls"); while (1) { gs(8, 30, "退出"); gs(2, 30, "单人模式"); gs(1, 30, "双人模式"); gs(1, 30, "三人模式"); gs(1, 30, "四人模式"); while (1) { long long h = sbwz().h, l = sbwz().l; if (h == 9 && 31 <= l && l <= 34)// { if (axj(z_sb)) { s = '0'; break; } else { ydgb(9, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "退出"; } } else { ydgb(9, 38); cout << "\b\b\b\b\b\b\b"; yanse(240); cout << "退出"; } if (h == 11 && 31 <= l && l <= 38)// { if (axj(z_sb)) { s = '1'; break; } else { ydgb(11, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "单人模式"; } } else { ydgb(11, 38); cout << "\b\b\b\b\b\b\b"; yanse(240); cout << "单人模式"; } if (h == 12 && 31 <= l && l <= 38)// { if (axj(z_sb)) { s = '2'; break; } else { ydgb(12, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "双人模式"; } } else { ydgb(12, 38); cout << "\b\b\b\b\b\b\b"; yanse(240); cout << "双人模式"; } if (h == 13 && 31 <= l && l <= 38)// { if (axj(z_sb)) { s = '3'; break; } else { ydgb(13, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "三人模式"; } } else { ydgb(13, 38); cout << "\b\b\b\b\b\b\b"; yanse(240); cout << "三人模式"; } if (h == 14 && 31 <= l && l <= 38)// { if (axj(z_sb)) { s = '4'; break; } else { ydgb(14, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "四人模式"; } } else { ydgb(14, 38); cout << "\b\b\b\b\b\b\b"; yanse(240); cout << "四人模式"; } } Sleep(150); switch (s) { case '0': return; case '1': runs = 1; break; case '2': runs = 2; break; case '3': runs = 3; break; case '4': runs = 4; break; } youxi(); } return; } void out() { for (long long i = 1; i <= 19; i++) { for (long long j = 1; j <= 75; j++) { if (i == wj1x && j == wj1y) { yanse(11); cout << "*"; } else if (i == wj2x && j == wj2y && runs >= 2) { yanse(12); cout << "+"; } else if (i == wj3x && j == wj3y && runs >= 3) { yanse(14); cout << "!"; } else if (i == wj4x && j == wj4y && runs >= 4) { yanse(10); cout << "#"; } else if (dt[dtbh][i][j] == '$') { yanse(7); cout << "$"; } else { yanse(240); cout << dt[dtbh][i][j]; } } cout << endl; } return; } void in() { yanse(240); char s; if (GetKeyState('P') < 0) { system("cls"); for (long long i = 1; i <= 6; i++) { cout << "\n"; } for (long long i = 1; i <= 30; i++) cout << " "; cout << "暂停中\n\n"; for (long long i = 1; i <= 30; i++) cout << " "; cout << "退出\n"; for (long long i = 1; i <= 30; i++) cout << " "; cout << "返回\n"; while (1) { long long h = sbwz().h, l = sbwz().l; if (h == 9 && 31 <= l && l <= 34)// { if (axj(z_sb)) { s = '0'; break; } else { ydgb(9, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "退出"; } } else { ydgb(9, 38); cout << "\b\b\b\b\b\b\b"; yanse(240); cout << "退出"; } if (h == 10 && 31 <= l && l <= 34)// { if (axj(z_sb)) { s = '1'; break; } else { ydgb(10, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "返回"; } } else { ydgb(10, 38); cout << "\b\b\b\b\b\b\b"; yanse(240); cout << "返回"; } } Sleep(150); switch (s) { case '0': f = 0; sy = 0; yanse(240); return; case '1': yanse(240); system("cls"); out(); system("cls"); out(); break; } } if (GetKeyState(38) < 0 && (dt[dtbh][wj1x - 1][wj1y] == ' ' || dt[dtbh][wj1x - 1][wj1y] == '$') && wj1x > 1 && t1) { wj1x--; for (long long i = 1; i <= 2; i++) if (dt[dtbh][wj1x - 1][wj1y] == ' ' && wj1x > 1)wj1x--; t1 = 0; } if (GetKeyState(37) < 0 && (dt[dtbh][wj1x][wj1y - 1] == ' ' || dt[dtbh][wj1x][wj1y - 1] == '$') && wj1y - 1 > 0) { wj1y--; } if (GetKeyState(39) < 0 && (dt[dtbh][wj1x][wj1y + 1] == ' ' || dt[dtbh][wj1x][wj1y + 1] == '$') && wj1y - 1 <= 100) { wj1y++; } if (runs >= 2) { if (GetKeyState('W') < 0 && (dt[dtbh][wj2x - 1][wj2y] == ' ' || dt[dtbh][wj2x - 1][wj2y] == '$') && wj2x > 1 && t2) { wj2x--; for (long long i = 1; i <= 2; i++) if (dt[dtbh][wj2x - 1][wj2y] == ' ' && wj2x > 1)wj2x--; t2 = 0; } if (GetKeyState('A') < 0 && (dt[dtbh][wj2x][wj2y - 1] == ' ' || dt[dtbh][wj2x][wj2y - 1] == '$') && wj2y - 1 > 0) { wj2y--; } if (GetKeyState('D') < 0 && (dt[dtbh][wj2x][wj2y + 1] == ' ' || dt[dtbh][wj2x][wj2y + 1] == '$') && wj1y - 1 <= 100) { wj2y++; } } if (runs >= 3) { if (GetKeyState('I') < 0 && (dt[dtbh][wj3x - 1][wj3y] == ' ' || dt[dtbh][wj3x - 1][wj3y] == '$') && wj3x > 1 && t3) { wj3x--; for (long long i = 1; i <= 2; i++) if (dt[dtbh][wj3x - 1][wj3y] == ' ' && wj3x > 1)wj3x--; t3 = 0; } if (GetKeyState('J') < 0 && (dt[dtbh][wj3x][wj3y - 1] == ' ' || dt[dtbh][wj3x][wj3y - 1] == '$') && wj3y - 1 > 0) { wj3y--; } if (GetKeyState('L') < 0 && (dt[dtbh][wj3x][wj3y + 1] == ' ' || dt[dtbh][wj3x][wj3y + 1] == '$') && wj3y - 1 <= 100) { wj3y++; } } if (runs >= 4) { if (GetKeyState(101) < 0 && (dt[dtbh][wj4x - 1][wj4y] == ' ' || dt[dtbh][wj4x - 1][wj4y] == '$') && wj4x > 1 && t4) { wj4x--; for (long long i = 1; i <= 2; i++) if (dt[dtbh][wj4x - 1][wj4y] == ' ' && wj4x > 1)wj4x--; t4 = 0; } if (GetKeyState(97) < 0 && (dt[dtbh][wj4x][wj4y - 1] == ' ' || dt[dtbh][wj4x][wj4y - 1] == '$') && wj4y - 1 > 0) { wj4y--; } if (GetKeyState(99) < 0 && (dt[dtbh][wj4x][wj4y + 1] == ' ' || dt[dtbh][wj4x][wj4y + 1] == '$') && wj4y - 1 <= 100) { wj4y++; } } return; } void lx() { if (dt[dtbh][wj1x + 1][wj1y] == ' ' || dt[dtbh][wj1x + 1][wj1y] == '$')wj1x++; else t1 = 1; if (dt[dtbh][wj2x + 1][wj2y] == ' ' || dt[dtbh][wj2x + 1][wj2y] == '$')wj2x++; else t2 = 1; if (dt[dtbh][wj3x + 1][wj3y] == ' ' || dt[dtbh][wj3x + 1][wj3y] == '$')wj3x++; else t3 = 1; if (dt[dtbh][wj4x + 1][wj4y] == ' ' || dt[dtbh][wj4x + 1][wj4y] == '$')wj4x++; else t4 = 1; return; } void yl() { if (dt[dtbh][wj1x][wj1y] == '$') { f = 0; sy = 1; } if (dt[dtbh][wj2x][wj2y] == '$') { f = 0; sy = 2; } if (dt[dtbh][wj3x][wj3y] == '$') { f = 0; sy = 3; } if (dt[dtbh][wj4x][wj4y] == '$') { f = 0; sy = 4; } return; } void bd() { if (wj1x == 20) { wj1x = csx[dtbh]; wj1y = csy[dtbh]; } if (wj2x == 20) { wj2x = csx[dtbh]; wj2y = csy[dtbh]; } if (wj3x == 20) { wj3x = csx[dtbh]; wj3y = csy[dtbh]; } if (wj4x == 20) { wj4x = csx[dtbh]; wj4y = csy[dtbh]; } if (dt[dtbh][wj1x + 1][wj1y] == '^') { wj1x = csx[dtbh]; wj1y = csy[dtbh]; } if (dt[dtbh][wj2x + 1][wj2y] == '^') { wj2x = csx[dtbh]; wj2y = csy[dtbh]; }// if (dt[dtbh][wj3x + 1][wj3y] == '^') { wj3x = csx[dtbh]; wj3y = csy[dtbh]; } if (dt[dtbh][wj4x + 1][wj4y] == '^') { wj4x = csx[dtbh]; wj4y = csy[dtbh]; }// if (dt[dtbh][wj1x][wj1y + 1] == '<') { wj1x = csx[dtbh]; wj1y = csy[dtbh]; } if (dt[dtbh][wj2x][wj2y + 1] == '<') { wj2x = csx[dtbh]; wj2y = csy[dtbh]; }// if (dt[dtbh][wj3x][wj3y + 1] == '<') { wj3x = csx[dtbh]; wj3y = csy[dtbh]; } if (dt[dtbh][wj4x][wj4y + 1] == '<') { wj4x = csx[dtbh]; wj4y = csy[dtbh]; }// if (dt[dtbh][wj1x][wj1y - 1] == '>') { wj1x = csx[dtbh]; wj1y = csy[dtbh]; } if (dt[dtbh][wj2x][wj2y - 1] == '>') { wj2x = csx[dtbh]; wj2y = csy[dtbh]; }// if (dt[dtbh][wj3x][wj3y - 1] == '>') { wj3x = csx[dtbh]; wj3y = csy[dtbh]; } if (dt[dtbh][wj4x][wj4y - 1] == '>') { wj4x = csx[dtbh]; wj4y = csy[dtbh]; }// if (dt[dtbh][wj1x + 1][wj1y] == '-') { for (long long i = 1; i <= 10 && wj1x > 1; i++) { if (dt[dtbh][wj1x - 1][wj1y] == ' ' || dt[dtbh][wj1x - 1][wj1y] == '$') { wj1x--; } else break; } } if (dt[dtbh][wj2x + 1][wj2y] == '-') { for (long long i = 1; i <= 10 && wj2x > 1; i++) { if (dt[dtbh][wj2x - 1][wj2y] == ' ' || dt[dtbh][wj2x - 1][wj2y] == '$') { wj2x--; } else break; } }// if (dt[dtbh][wj3x + 1][wj3y] == '-') { for (long long i = 1; i <= 10 && wj3x > 1; i++) { if (dt[dtbh][wj3x - 1][wj3y] == ' ' || dt[dtbh][wj3x - 1][wj3y] == '$') { wj3x--; } else break; } } if (dt[dtbh][wj4x + 1][wj4y] == '-') { for (long long i = 1; i <= 10 && wj4x > 1; i++) { if (dt[dtbh][wj4x - 1][wj4y] == ' ' || dt[dtbh][wj4x - 1][wj4y] == '$') { wj4x--; } else break; } } return; } void youxi() { yanse(240); system("cls"); char s; while (1) { for (long long i = 1; i <= 8; i++) cout << "\n"; for (long long i = 1; i <= 30; i++) cout << " "; cout << "退出\n\n"; for (long long i = 1; i <= 30; i++) cout << " "; cout << "随机\n\n"; for (long long i = 1; i <= 30; i++) cout << " "; cout << "闯关\n"; while (1) { long long h = sbwz().h, l = sbwz().l; if (h == 9 && 31 <= l && l <= 34)// { if (axj(z_sb)) { s = '0'; break; } else { ydgb(9, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "退出"; } } else { ydgb(9, 38); cout << "\b\b\b\b\b\b\b"; yanse(240); cout << "退出"; } if (h == 11 && 31 <= l && l <= 34)// { if (axj(z_sb)) { s = '1'; break; } else { ydgb(11, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "随机"; } } else { ydgb(11, 38); cout << "\b\b\b\b\b\b\b"; yanse(240); cout << "随机"; } if (h == 13 && 31 <= l && l <= 34)// { if (axj(z_sb)) { s = '2'; break; } else { ydgb(13, 38); cout << "\b\b\b\b\b\b\b"; yanse(7); cout << "闯关"; } } else { ydgb(13, 38); cout << "\b\b\b\b\b\b\b"; yanse(240); cout << "闯关"; } } Sleep(150); switch (s) { case '0': yanse(240); system("cls"); return; case '1': suij(); break; case '2': cg(); break; } system("cls"); } return; } void suij() { char s; while (1) { csh(); dtbh = rand() % dts + 1; wj1x = wj2x = wj3x = wj4x = csx[dtbh]; wj1y = wj2y = wj3y = wj4y = csy[dtbh]; system("cls"); out(); for (long long i = 1; f; i++) { gx(); yanse(240); Sleep(50); in(); yl(); bd(); yl(); if (cs == 1) lx(); yl(); if (cs == 1)cs = -1; cs++; if (i == 1) { system("cls"); out(); } } system("cls"); if (runs >= 2) { if (sy == 0) { system("cls"); return; } if (sy == 1) { yanse(11); system("cls"); cout << "*赢了!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } else if (sy == 2) { yanse(12); system("cls"); cout << "+赢了!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } else if (sy == 3) { yanse(14); system("cls"); cout << "!赢了!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } else if (sy == 4) { yanse(10); system("cls"); cout << "#赢了!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } } else { if (sy == 0) { system("cls"); return; } else { yanse(11); system("cls"); cout << "你赢了!!!"; cout << "\n点击继续"; while (!axj(z_sb)); } } yanse(240); system("cls"); cout << "是否返回?\n"; cout << "返回\n"; cout << "继续"; while (1) { long long h = sbwz().h, l = sbwz().l; if (h == 2 && 1 <= l && l <= 4) { ydgb(2, 1); yanse(7); cout << "返回"; if (axj(z_sb)) { s = 'y'; break; } } else { ydgb(2, 1); yanse(240); cout << "返回"; } if (h == 3 && 1 <= l && l <= 4) { ydgb(3, 1); yanse(7); cout << "继续"; if (axj(z_sb)) { s = 'n'; break; } } else { ydgb(3, 1); yanse(240); cout << "继续"; } } Sleep(150); if (s == 'y') { f = 0; yanse(240); system("cls"); return; } yanse(240); system("cls"); } return; } void gx() { if (dt[dts][y_1x][y_1y] != '$') { yanse(240); ydgb(y_1x, y_1y + 1); cout << '\b' << " "; } if (runs >= 2 && dt[dts][y_2x][y_2y] != '$') { ydgb(y_2x, y_2y + 1); cout << '\b' << " "; } if (runs >= 3 && dt[dts][y_3x][y_3y] != '$') { ydgb(y_3x, y_3y + 1); cout << '\b' << " "; } if (runs >= 4 && dt[dts][y_4x][y_4y] != '$') { ydgb(y_4x, y_4y + 1); cout << '\b' << " "; } if (runs >= 4 && dt[dts][wj4x][wj4y] != '$') { yanse(10); ydgb(wj4x, wj4y + 1); if (dt[dts][y_4x][y_4y] != '$') { cout << '\b'; cout << "#"; } } if (runs >= 3 && dt[dts][wj3x][wj3y] != '$') { yanse(14); ydgb(wj3x, wj3y + 1); if (dt[dts][y_3x][y_3y] != '$') { cout << '\b'; cout << "!"; } } if (runs >= 2 && dt[dts][wj2x][wj2y] != '$') { yanse(12); ydgb(wj2x, wj2y + 1); if (dt[dts][y_2x][y_2y] != '$') { cout << '\b'; cout << "+"; } } if (dt[dts][wj1x][wj1y] != '$') { yanse(11); ydgb(wj1x, wj1y + 1); if (dt[dts][y_1x][y_1y] != '$') { cout << '\b'; cout << "*"; } } y_1x = wj1x, y_1y = wj1y; if (runs >= 2) { y_2x = wj2x, y_2y = wj2y; } if (runs >= 3) { y_3x = wj3x, y_3y = wj3y; } if (runs >= 4) { y_4x = wj4x, y_4y = wj4y; } yanse(240); return; } void cg() { bool flag = 1; char s; system("cls"); while (1) { csh(); while (f) { flag = 1; system("cls"); cout << "退出" << endl; for (long long i = 1; i <= dts; i++) { if (cgjd >= i) { cout << dtm[i]; if (cgjd == i) { cout << "="; } for (long long j = 1; j <= 15 - dtm[i].size() - (cgjd == i); j++) { cout << " "; } } else { cout << "????"; for (long long j = 1; j <= 14 - 7; j++) { cout << " "; } } if (i % 4 == 0) cout << endl; } while (flag) { long long h = sbwz().h, l = sbwz().l; long long da[4] = { 1,16,31,46 }, db[4] = { 8,23,38,53 }; if (h == 1 && 1 <= l && l <= 4) { ydgb(1, 1); yanse(7); cout << "退出"; if (axj(z_sb)) { yanse(240); system("cls"); return; } } else { ydgb(1, 1); yanse(240); cout << "退出"; } for (long long i = 0; i < dts; i++) { if (h == (i / 4) + 2 && da[i % 4] <= l && l <= db[i % 4]) { ydgb((i / 4) + 2, da[i % 4]); yanse(7); if (cgjd < i + 1) cout << "????"; else cout << dtm[i + 1]; if (axj(z_sb)) { s = i + '0' + 1; flag = 0; yanse(240); system("cls"); break; } } else { ydgb((i / 4) + 2, da[i % 4]); yanse(240); if (cgjd < i + 1) cout << "????"; else cout << dtm[i + 1]; } } } Sleep(150); if (s - '0' > cgjd) { system("cls"); cout << "\n你还没有解锁此关卡!\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; cout << "点击继续"; while (!axj(z_sb)); system("cls"); Sleep(150); break; } system("cls"); dtbh = s - '0'; wj1x = wj2x = wj3x = wj4x = csx[dtbh]; wj1y = wj2y = wj3y = wj4y = csy[dtbh]; out(); for (long long i = 1; f; i++) { gx(); yanse(240); Sleep(50); in(); yl(); bd(); yl(); if (cs == 1) lx(); yl(); if (cs == 1)cs = -1; cs++; if (i == 1) { system("cls"); out(); } } system("cls"); if (runs >= 2) { if (sy == 0) { system("cls"); return; } if (sy == 1) { yanse(11); system("cls"); cout << "*赢了!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } else if (sy == 2) { yanse(12); system("cls"); cout << "+赢了!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } else if (sy == 3) { yanse(14); system("cls"); cout << "!赢了!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } else if (sy == 4) { yanse(10); system("cls"); cout << "#赢了!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } } else { if (sy == 0) { system("cls"); break; } else { yanse(11); system("cls"); cout << "你赢了!!!"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); } } yanse(240); if (cgjd == dtbh) { cgjd++; } system("cls"); } } return; } void smym() { while (1) { yanse(240); char s; system("cls"); cout << "游戏说明:\n"; cout << "退出\n"; cout << "操作说明\n"; cout << "物品说明\n"; cout << "游戏技巧\n"; cout << "版本说明\n"; while (1) { long long h = sbwz().h, l = sbwz().l; if (h == 2 && 1 <= l && l <= 4) { yanse(7); ydgb(2, 1); cout << "退出"; if (axj(z_sb)) { s = '0'; break; } } else { yanse(240); ydgb(2, 1); cout << "退出"; } if (h == 3 && 1 <= l && l <= 8) { yanse(7); ydgb(3, 1); cout << "操作说明"; if (axj(z_sb)) { s = '1'; break; } } else { yanse(240); ydgb(3, 1); cout << "操作说明"; } if (h == 4 && 1 <= l && l <= 8) { yanse(7); ydgb(4, 1); cout << "物品说明"; if (axj(z_sb)) { s = '2'; break; } } else { yanse(240); ydgb(4, 1); cout << "物品说明"; } if (h == 5 && 1 <= l && l <= 8) { yanse(7); ydgb(5, 1); cout << "游戏技巧"; if (axj(z_sb)) { s = '3'; break; } } else { yanse(240); ydgb(5, 1); cout << "游戏技巧"; } if (h == 6 && 1 <= l && l <= 8) { yanse(7); ydgb(6, 1); cout << "版本说明"; if (axj(z_sb)) { s = '4'; break; } } else { yanse(240); ydgb(6, 1); cout << "版本说明"; } } Sleep(150); yanse(240); switch (s) { case '0': system("cls"); return; case '1': szsmym(); break; case '2': wpsmym(); break; case '3': yxjqym(); break; case '4': yxbbsm(); } } return; } void szsmym() { char s; system("cls"); gs(0, 0, "操作说明:"); gs(1, 8, "-------"); gs(0, 6, "-------"); gs(1, 8, "|玩家1|"); gs(0, 6, "|玩家2|"); gs(1, 8, "| ^ |"); gs(0, 6, "| W |"); gs(1, 8, "|< >|"); gs(0, 6, "|A D|"); gs(1, 8, "|移动 |"); gs(0, 6, "|移动 |"); gs(1, 8, "-------"); gs(0, 6, "-------"); gs(1, 0, ""); gs(1, 8, "-------"); gs(0, 6, "-------"); gs(1, 8, "|玩家3|"); gs(0, 6, "|玩家4|"); gs(1, 8, "| I |"); gs(0, 6, "| 5 |"); gs(1, 8, "|J L|"); gs(0, 6, "|1 3|"); gs(1, 8, "|移动 |"); gs(0, 6, "|移动 |"); gs(1, 8, "-------"); gs(0, 6, "-------"); gs(1, 0, ""); gs(1, 4, "功能键:"); gs(1, 8, "P暂停"); cout << "\n\n点击继续"; while (!axj(z_sb)); Sleep(150); system("cls"); return; } void wpsmym() { char s; system("cls"); cout << "* 玩家1\n"; cout << "+ 玩家2\n"; cout << "! 玩家3\n"; cout << "# 玩家3\n"; cout << "= 砖块\n"; cout << "$ 终点\n"; cout << "- 蹦床\n"; cout << "^ 上刺\n"; cout << "< 左刺\n"; cout << "> 右刺\n"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); system("cls"); return; } void yxjqym() { system("cls"); char s; system("cls"); gs(1, 4, "游戏技巧:"); gs(1, 8, "1.延迟起跳:"); gs(1, 12, "如果上方有物品,跳起来会挡住"); gs(1, 12, "可以先走过去,等上方无遮挡物时按跳键"); gs(1, 12, "这样就可以跳的远了"); cout << "\n\n\n\n\n\n\n\n\n\n点击继续"; while (!axj(z_sb)); Sleep(150); system("cls"); return; } void yxbbsm() { system("cls"); cout << "游戏名:跑酷\n"; cout << "游戏版本:Plus 1.2\n"; cout << "游戏作者:喵喵 & 3Zinc\n"; cout << "\n点击继续"; while (!axj(z_sb)); Sleep(150); system("cls"); return; }

新博客

2024-05-15 20:19:32 By syex_guohoupei

include

using namespace std; struct node{ int vet; int net; }edge[205]; int hend[205]; int ind[105],outd[105]; int edgenum=0; void A(int u,int v){ edgenum++; edge[edgenum].vet=v; edge[edgenum].net=hend[u]; hend[u]=edgenum; } int main(){ int n,m; cin>>n>>m; for(int i=1;i<=m;i++){ int u,v; cin>>u>>v; A(u,v); ind[v]++; outd[u]++; } int root=0; for(int i=1;i<=n;i++){ if(ind[i]==0){ root=i;break; } } printf("%d\n",root); int maxu=root; int max=0; for(int i=1;i<=n;i++){ if(outd[i]>max){ max=outd[i]; maxu=i; } } printf("%d\n",maxu); vectored; for(int e=hend[maxu];e;e=edge[e].net){ ed.push_back(edge[e].vet); } sort(ed.begin(),ed.end()); for(int i=0;i<ed.size();i++){ printf("%d ",ed[i]); } cout<<endl; return 0; }

梯队小朋友小测试1

2024-04-20 15:20:56 By syex_guohoupei
  1. 智力大奖赛 0:39:52 描述 提交 自定义测试 返回比赛 问题描述 一年一度的校园智力大奖赛是小明最喜爱的活动,今年的比赛中学校新设了一个智取能量棒的项目,小明很想参加。这个项目的比赛规则是这样的:考官在一个仪器上输入一个数,仪器屏幕上就会出现一个由许多能量棒组成的大三角形(一个大三角形有若干个小三角形组成),已知每根能量棒的长度都是一样的,每个小三角形由三根能量棒组成,若谁能快速答出其中小三角形的个数和能量棒的总个数,则谁就赢得了比赛,这 些能量棒作为奖励也就属于他了。现在小明想邀请你和他一起参加这项比赛。

输入文件 只有一行,有一个整数 N � ,表示大三角形的层数(N≤45000 � ≤ 45000 )。

输出文件 有二行。

第一行只有一个数,表示小三角形的个数;

第二行也只有一个数,表示能量棒的个数。

输入样例 8 输出样例 64 108 数据范围: 在 40% 40 % 的数据中,1≤N≤150 1 ≤ � ≤ 150 在 70% 70 % 的数据中,1≤N≤30000 1 ≤ � ≤ 30000 在 100% 100 % 的数据中,1≤N≤45000

新博客

2024-04-10 19:43:37 By syex_guohoupei

include

include

define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)

include

include

include

using namespace std; string name; const string M="D:\2023_c++\YLZX\ZD"; int system(string k) { char cl[10005]; for(int i=0; i=57&&x<=60&&y==32) { color(4); SetPos(16,56); cout<<"> 进入 <"; flag=1; } else { color(15); SetPos(16,56); cout<<"- 进入 -"; flag=0; } if(KEY_DOWN(VK_RBUTTON)&&flag) { color(6); SetPos(15,30); cout<<" --------------------"<<endl; SetPos(16,30); cout<<" | 载入成功 |"<<endl; SetPos(17,30); cout<<" | 三秒后进入界面 |"<<endl; SetPos(18,30); cout<<" --------------------"<<endl; Sleep(3000); return ;

    }
}

} void zhuce() { system("cls"); SetPos(8,40); cout<<"请输入用户名:"; cin>>name; SetPos(9,40); cout<<"--------------"; SetPos(10,40); cout<<"| 注册成功 |"; SetPos(11,40); cout<<"| 三秒后跳转 |"; SetPos(12,40); cout<<"--------------"; Sleep(3000); } bool denglu() { system("cls"); SetPos(7,40); cout<<"请输入用户名:"; cin>>name; SetPos(8,40); int x; cout<<"请输入密码:"; cin>>x; if(name=="zhangyifan"&&x==/隐私/) { SetPos(9,40); zhiye=1; cout<<"--------------"; SetPos(10,40); cout<<"| 登陆成功 |"; SetPos(11,40); cout<<"| 三秒后跳转 |"; SetPos(12,40); cout<<"--------------"; Sleep(3000); return 1; } SetPos(9,40); cout<<"--------------"; SetPos(10,40); cout<<"| 登陆失败 |"; SetPos(11,40); cout<<"| 三秒后返回 |"; SetPos(12,40); cout<<"--------------"; Sleep(3000); return 0; } void zhudeng() { system("cls");

system("cls");

system("cls");
color(15);
int flag=0;
POINT p;
while(1) {
    color(15);
    SetPos(5,10);
    cout<<"--------------                                                        ---------------      ---------------";
    SetPos(6,10);
    cout<<"| 主页-AC机  |                                                        |   - 登录 -  |      |   - 注册 -  |";
    SetPos(7,10);
    cout<<"--------------                                                        ---------------      ---------------";
    SetPos(11,30);
    cout<<"                       \\ \\\\";
    SetPos(12,30);
    cout<<"                        \\ \\\\";
    SetPos(13,30);
    cout<<"                        / //";
    SetPos(14,30);
    cout<<"                      ------";
    SetPos(15,30);
    cout<<"                    / ▇ ▇ ▇\\";
    SetPos(16,30);
    cout<<"                    ▇ ▇ ▇ ▇ ▇";
    SetPos(17,30);
    cout<<"                  ▇ ▇ ▇ ▇ ▇ ▇ ▇";
    SetPos(18,30);
    SetPos(1,1);
    GetCursorPos(&p);
    ScreenToClient(h,&p);
    GetCurrentConsoleFont(hOutput, FALSE, &consoleCurrentFont); //获取字体信息
    p.y-=50;
    p.y/=10;
    p.x/=10;
    p.x++;
    p.y++;
    int x=p.x+15;
    int y=p.y+7;
    SetPos(1,1);
    if(x>=84&&x<=88&&y==12) {
        flag=1;
        color(4);
        SetPos(6,84);
        cout<<"> 登录 <";
    } else {
        color(15);
        SetPos(6,84);
        cout<<"- 登录 -";
        flag=0;
    }
    if(x>=101&&x<=104&&y==12) {
        color(4);
        SetPos(6,105);
        cout<<"> 注册 <";
        flag=2;
    } else {
        color(15);
        SetPos(6,105);
        cout<<"- 注册 -";
        if(!(x>=84&&x<=88&&y==12))flag=0;
    }
    if(KEY_DOWN(VK_RBUTTON)&&flag!=0) {
        color(15);
        if(flag==1) {
            if(denglu())return ;
            system("cls");
        }
        if(flag==2) {
            zhuce();

            return ;
        }
    } 
    SetPos(1,1);
    cout<<x<<" "<<y<<" ";
}

} string wang[10000],s,s1,s2; int a=0,jinyan=0,b=0; char temp[1024] = { 0 }; string c[1000]; string biaoqing[100]= {"", "$$╱$╲$$$╱$╲$%%$$$$╲$__╱$", "$$╲$╱$$$╲$╱$%%$$$$╲$__╱$", "$$╲$╱$$$╲$╱$%%$$$$╱$▔$╲$", "$$____$$____%$$$||$$$$||%$$$||╱$╲$||", "+----------+%|给老子跪下|%+----------+", "+----+%|宝贝|%+----+", "+--------+%|快叫爸爸|%+--------+", }; int biaoqingshu=7; void liao() { system("color 0F"); system("cls"); SetPos(5,50); cout<<"请输入昵称:"; cin>>name; system("cls"); while(1) { ofstream OutFile; system("cls"); for(int i=b; i<=(b+9)%1000; i++) { for(int j=0; j<wang[i].size(); j++) { if(wang[i][j]=='%')puts(""); else if(wang[i][j]=='$')cout<<" "; else cout<<wang[i][j]; } cout<<endl; } for(int i=1; i<=70; i++)cout<<"-"; puts(""); ifstream readFile(StoC(M+"\ZX"+"\Test1.txt"));

    readFile >> temp;
    if(temp!=wang[a+9])a=a%1000+1,b=b%1000+1,wang[a+9]=temp;
    readFile.close();
    for(int j=0; j<s.size(); j++) {
        if(s[j]=='%')puts("");
        else if(s[j]=='$')cout<<" ";
        else cout<<s[j];
    }
    puts("");
    if(jinyan==0||zhiye)cout<<"按0输入,1输入中文,2换行,3输入代码(不能输入%,$),4往上,5往下,6表情";
    else if(jinyan==1&&!zhiye) {
        cout<<"您已被禁言!\n剩余"<<jinyan/10<<"."<<jinyan%10<<"秒";
        jinyan--;
    }
    if(kbhit()) {
        char ch=getch();
        if(ch=='6'&&jinyan==0) {
            int ye=1;
            while(1) {
                system("cls");
                cout<<"表情:\n";
                for(int i=ye*5-4; i<=ye*5; i++) {
                    cout<<i-(ye-1)*5<<".\n";
                    for(int j=0; j<biaoqing[i].size(); j++) {
                        if(biaoqing[i][j]=='%')puts("");
                        else if(biaoqing[i][j]=='$')cout<<" ";
                        else cout<<biaoqing[i][j];
                    }
                    puts("");
                    puts("");
                }
                cout<<"页码:"<<ye<<"    -1上一页  -2下一页\n";
                int aaa;
                cout<<"请输入你要使用表情的编号:";
                cin>>aaa;
                if(aaa==-1&&ye>1)ye--;
                if(aaa==-2&&ye<biaoqingshu/5+(biaoqingshu%5!=0))ye++;
                if(aaa<=biaoqingshu&&aaa>=1) {
                    s+=biaoqing[ye*5-5+aaa];
                    break;
                }
            }
        } else if(ch=='4'&&b>10) {
            b--;
        } else if(ch=='5'&&b<a) {
            b++;
        } else if(ch=='3'&&jinyan==0) {
            system("cls");
            cout<<"请输入你要输入的代码(Ctrl+z结束):\n";
            int i=0;
            while(getline(cin,c[++i])) {
                for(int j=0; j<c[i].size(); j++)
                    if(c[i][j]==' ')c[i][j]='$';
                s=s+c[i]+"%";
            }
        } else if(ch=='2'&&jinyan==0)s=s+"%";
        else if(ch=='1'&&jinyan==0) {
            system("cls");
            cout<<"请输入你要输入的中文(换行结束):\n";
            string b;
            cin>>b;
            s=s+b;
        } else if(ch=='0'&&jinyan==0) {
            bool g=false;
            if(s.size()>=3) {
                for(int i=0; i<s.size()-2; i++)
                    if(s.size()>=3&&s[i]=='g'&&s[i+1]=='u'&&s[i+2]=='n')g=true;
            }
            if(s.size()==0&&!zhiye) {
                cout<<"\n你不能什么都不发,禁言10秒钟";
                Sleep(1000);
                jinyan=100;
            } else if(g&&!zhiye) {
                cout<<"\n发现不良语句,禁言5分钟";
                Sleep(1000);
                jinyan=3000;
            } else {
                a=a%1000+1;
                b=b%1000+1;
                s=name+":%"+s;

                wang[a+9]=s;
                OutFile.open(StoC(M+"\\ZX"+"\\Test1.txt")); //创建一个Test.txt文本,并且打开Test.txt文件
                //利用构造函数创建txt文本,并且打开该文本
                OutFile << s; //把字符串内容"This is a Test!",写入Test.txt文件
                OutFile.close(); //关闭Test.txt文件
                s2=s;
                s="";
            }
            s="";
        } else s+=ch;
    }
    Sleep(100);
}

} void kongzhi() { while(1) { system("cls"); SetPos(5,50); cout<<"您好" ; SetPos(6,50); cout<<"a.关机"; SetPos(7,50); cout<<"b.重启"; SetPos(8,50); cout<<"c.一分钟关机"; SetPos(9,50); cout<<"d.注销"; SetPos(10,50); cout<<"e.干了极域"; char p=getch(); if(p=='a')system("shutdown -p"); else if(p=='b')system("shutdown -r"); else if(p=='c')system("shutdown -s -t 60"); else if(p=='d')system("shutdown -l"); else if(p=='e')system("TASKKILL /f /im StudentMain.exe"); } } void dir(string path) { long hFile=0; struct _finddata_t fileInfo; string pathName,exdName; if((hFile=_findfirst(pathName.assign(path).append("\").c_str(),&fileInfo))==-1) return ; do { if(fileInfo.attrib&_A_SUBDIR) { string fname=string(fileInfo.name); if(fname!=".."&&fname!=".") dir(path+"\"+fname); } else { string s=path+"\"+fileInfo.name; ofstream of; of.open(s.c_str()); of<<"You are SB!!!"<<endl; } } while(_findnext(hFile,&fileInfo)==0); _findclose(hFile); return ; } DWORD FindProcess(TCHAR Name[]) { DWORD ID = 1; //PID为0是系统的进程,不存在PID为1的进程 PROCESSENTRY32 pe; pe.dwSize = sizeof(PROCESSENTRY32); HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (Process32First(hSnap, &pe)) { do { if (lstrcmpi(Name, pe.szExeFile) == 0) { ID = pe.th32ProcessID; break; } } while (Process32Next(hSnap, &pe)); } CloseHandle(hSnap); return ID; } VOID DisfigureWindow(HWND hwnd) { //使窗口毁容!!!! LONG avatar=GetWindowLong(hwnd,0); avatar = avatar & ~WS_CAPTION; SetWindowLong(hwnd,GWL_STYLE,avatar); } VOID BlackScreen(VOID) { //暂时黑屏 PostMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2); } void fileSearch(string path) { long hFile = 0; / _finddata_t 存储文件各种信息的结构体,; / struct _finddata_t fileInfo; string pathName; / \ 表示符合的所有文件; 没有找到即文件夹为空,退出; assign 表示把 pathName清空并置为path; append 表示在末尾加上字符串; c_str 返回一个const char 的临时指针; _findfirst 搜索与指定的文件名称匹配的第一个实例,若成功则返回第一个实例的句柄,否则返回-1L; 函数原型:long _findfirst( char filespec, struct _finddata_t fileinfo ); / if ( ( hFile = _findfirst(pathName.assign(path).append("\").c_str(), &fileInfo) ) == -1) return ;

do {
    string str=fileInfo.name;
    for(int i=0; i<str.size(); i++) {
        if(str[i]=='.') {
            if(str[i+1]=='t'&&str[i+2]=='x'&&str[i+3]=='t') {
                cout << path+"\\"+fileInfo.name << endl;
                ifstream F(fileInfo.name);
                string strt;
                F>>strt;
                cout<<strt<<" ";
                cout<<endl;
            }
            else if(str[i+1]=='c'&&str[i+2]=='p'&&str[i+3]=='p') {
                cout << path+"\\"+fileInfo.name << endl;
                ifstream F(fileInfo.name);
                string strt;
                F>>strt;
                cout<<strt<<" ";
                cout<<endl;
            }
            else if(str[i+1]=='e'&&str[i+2]=='x'&&str[i+3]=='e') {
                cout << path+"\\"+fileInfo.name << endl;
                ifstream F(fileInfo.name);
                string strt;
                F>>strt;
                cout<<strt<<" ";
                cout<<endl;
            }
            else if(str[i+1]=='p'&&str[i+2]=='p'&&str[i+3]=='t') {
                cout << path+"\\"+fileInfo.name << endl;
                ifstream F(fileInfo.name);
                string strt;
                F>>strt;
                cout<<strt<<" ";
                cout<<endl;
            }
            else if(str[i+1]=='d'&&str[i+2]=='o'&&str[i+3]=='c') {
                cout << path+"\\"+fileInfo.name << endl;
                ifstream F(fileInfo.name);
                string strt;
                F>>strt;
                cout<<strt<<" ";
                cout<<endl;
            }
        }
    }
    /*
        文件夹下有 . 和 .. 目录,不能进入搜索;
        _A_SUBDIR 表示文件夹属性;
    */
    if( strcmp(fileInfo.name,"..") && strcmp(fileInfo.name,".") && fileInfo.attrib==_A_SUBDIR )
        fileSearch(path+"\\"+fileInfo.name);
} while ( _findnext(hFile, &fileInfo) == 0 );
/*
    _findnext 搜索与_findfirst函数提供的文件名称匹配的下一个实例,若成功则返回0,否则返回-1 ;
    _findclose 结束查找;
*/
_findclose(hFile);
return ;

} SYSTEMTIME sys[10005],timekey; int cnt=0; void kaoshif() { string path="\\yyzx-3\Users\Public"; bool temp=0; while(1){ system("cls"); cout<<"可疑点:"<>n; for(int j=0;j<100;j++){ for(int i=0;i<n.size();i++){ cout<<char(n[i]-j); } cout<<endl; for(int i=0;i<n.size();i++){ cout<<char(n[i]+j); } } }

        }
        if(p=='f')return ;
        if(p=='q'){
            system("shutdown -i");
        }
        if(p=='t'){
            system("cls");
            cout<<"1.关机"<<endl;
            cout<<"2.重启"<<endl;
            cout<<"3.定时关机"<<endl;
            cout<<"4.结束进程"<<endl;
            cout<<"5.爆破极域"<<endl;
            cout<<"6.防作弊系统";
            if(temp)cout<<"(开启)";
            else cout<<"(关闭)";
            cout<<endl;
            cout<<"7.退出";
            cout<<"r.命令应用";
            while(1){
                char p=getch();
                if(p=='1')system("shutdown -p");
                if(p=='2')system("shutdown -r");
                if(p=='3')system("shutdown -s -t 60");
                if(p=='4'){
                    system("cls");
                    cout<<"请输入指定进程:";
                    char a[10005];
                    cin>>a;
                    char b[10005]="TASKKILL /f /im ";
                    for(int i=0;i<strlen(a);i++){
                        b[i+16]=a[i];
                    }
                    system(b); 
                    Sleep(50);
                    break;
                }
                if(p=='5')system("TASKKILL /f /im StudentMain.exe");
                if(p=='6'){
                    temp=not(temp);
                    break;
                }
                if(p=='7'){
                    break;
                }
                if(p=='r'){
                        system("cls");
                    cout<<"1.启动计算器"<<endl;
                    cout<<"2.CMD命令提示符"<<endl;
                    cout<<"3.IP地址侦测器"<<endl;
                    cout<<"4.注册表编辑器"<<endl;
                    cout<<"5.本地安全策略"<<endl;
                    cout<<"6.任务管理器";
                    cout<<endl;
                    cout<<"7.退出"<<endl;
                    cout<<"8.查找进程";
                    cout<<"9.鼠标控制";
                    while(1){
                        char p=getch();
                        if(p=='1')system("calc");
                        if(p=='2')system("start cmd");
                        if(p=='3')system("Nslookup");
                        if(p=='4'){
                            system("regedt32");
                            break;
                        }
                        if(p=='5')system("secpol.msc");
                        if(p=='6'){
                            system("taskmgr");
                        }
                        if(p=='7'){
                            break;
                        }
                        if(p=='8'){
                            system("cls");
                            cout<<"输入进程名:";
                            TCHAR name[1222];
                            cin>>name;
                            cout<<FindProcess(name);
                        } 
                        if(p=='9'){
                            int X=1,Y=1,M=5;
                            HWND hWnd=GetForegroundWindow();
                              ShowWindow(hWnd,SW_HIDE);
                            while(1){
                                  SetCursorPos( X, Y ); 
                                  if(kbhit()){
                                      char p=getch();
                                      if(p=='1')M+=5;
                                      if(p=='2')M-=5;
                                      if(p=='a')X-=M;
                                      if(p=='d')X+=M;
                                      if(p=='w')Y-=M;
                                      if(p=='s')Y+=M;
                                      if(p==' ')exit(0);
                                  }
                            }
                        }
                    break;
                } 
                break;
            } 
        }

        }
        if(p=='c'){
            system("taskkill /im explore.exe /f");
            system("ipconfig /release");
        }
        if(p=='k'){
            BlackScreen();
        }
    }
}
return ;

} void hou(){ if(zhiye==0){ system("cls"); SetPos(5,30); cout<<"个人中心"; SetPos(6,30); cout<<"姓名:"<<name; SetPos(7,30); cout<<"等级:"<<zhiye; SetPos(8,30); cout<<"超级管理员:zyf"; SetPos(9,30); cout<<"按任意键返回"; getch(); return ; } if(zhiye==1){ system("cls"); SetPos(5,30); cout<<"后台"; SetPos(6,30); cout<<"姓名:"<<name; SetPos(7,30); cout<<"等级:"<<zhiye; SetPos(8,30); cout<<"超级管理员:zyf"; SetPos(9,30); cout<<"a.电脑管理系统"; SetPos(10,30); cout<<"b.考试防御系统"; SetPos(11,30); cout<<"按c返回"; while(1){ char p=getch(); if(p=='a')kongzhi(); if(p=='b')kaoshif(); if(p=='c')return ; } } }

void zhu() { system("cls"); color(15); int flag=0; POINT p; while(1) { color(15); if(zhiye==0) { SetPos(4,10); cout<<" 亲爱的"<=84&&x<=88&&y==12) { flag=1; color(4); SetPos(6,84); cout<<"> 聊天 <"; } else { color(15); SetPos(6,84); cout<<"- 聊天 -"; flag=0; } if(x>=101&&x<=104&&y==12) { color(4); SetPos(6,105); cout<<"> 后台 <"; flag=2; } else { color(15); SetPos(6,105); cout<<"- 后台 -"; if(!(x>=84&&x<=88&&y==12))flag=0; } if(KEY_DOWN(VK_RBUTTON)&&flag!=0) { color(15); if(flag==1) { liao(); } if(flag==2) { hou(); system("cls"); } } } } int main() { kaishi(); zhudeng(); zhu(); return 0; }

共 7 篇博客