跳到正文

Wujiahua1331

721893

在洛谷打开
资料、奖项与版本

资料

编号
721893
抓取

https://www.chlusi.com/view/293/293553/60355737_2.html

https://www.chlusi.com/view/257/257447/

https://www.chlusi.com/view/284/284733/60119028.html

https://www.chlusi.com/view/369/369209/

心中有火,双目失明(眼里有光)。 c++,从入门到入土(doge。

3386017549
znbw@135

方礼栋 https://www.luogu.com.cn/paste/lm5y7gvb

递归 https://www.luogu.com.cn/paste/20uyhste

贪心 https://www.luogu.com/paste/l3lz7e89

综合练习二分系列 https://www.luogu.com/paste/p9qujsml

单源最短路堆优化 https://www.luogu.com/paste/o5wbf2ia

最短路 单元复习 https://www.luogu.com/paste/wko7g9br

Dijkstra 算法 https://www.luogu.com/paste/37paomt0

二分 https://www.luogu.com.cn/paste/kbakssob

最短路算法(二) https://www.luogu.com/paste/fbh9y1qc

图论二笔记 https://www.luogu.com/paste/j4rxhcds

https://www.luogu.com/paste/zlop00tm 图论三

递推 https://www.luogu.com.cn/paste/x3vjcm63

柯桥春季B班第26课 最短路算法基础(一)

https://www.luogu.com/paste/v3jldc0a

方礼栋 邻接矩阵 https://www.luogu.com.cn/paste/ywohrqaz

https://www.luogu.com.cn/user/722062

苦逼的旅行者 http://kubitionadvanture.sinaapp.com/

stl库里的链表是双链表

关键字 list

#include <list> // 头文件 定义:list <int> l;

方法: push_front() // 在list的头部添加一个元素

push_back() // 在list的末尾添加一个元素

pop_front() // 删除第一个元素

pop_back() // 删除最后一个元素

begin() // 返回指向第一个元素的迭代器

end() // 返回末尾的迭代器

insert() // 插入一个元素到 list 中 //需要给迭代器

remove() // 从 list 删除指定元素 size() // 返回list中的元素个数

empty() // 如果list是空的则返回true

clear() // 删除所有元素

#include <iostream> #include <string> #include <cstdlib> #include <ctime> #include <windows.h> using namespace std;

// 角色属性类 class Role { public: string name; int hp = 100; int attack = 15; int defense = 8; int stamina = 70; };

// 敌人数据结构 struct Enemy { string name; int hp; int attack; string description; };

// 游戏核心逻辑 class StoryGame { private: Role player; int day = 1; bool hasKey = false;

C++
void showStatus() {
    cout << "\n■ 角色状态 ■" << endl;
    cout << "生命值:" << player.hp << "/100" << endl;
    cout << "体力值:" << player.stamina << "/100" << endl;
}

void dayEvent() {
    cout << "\n▄▄▄ 第 " << day << " 天 ▄▄▄" << endl;
    // 随机事件生成(示例)
    if(rand()%100 < 30) {
        combatSystem(Enemy{"变异鼠", 40, 12, "发出刺耳叫声的生物"});
    } else {
        cout << "你在废墟中找到一些补给品" << endl;
        player.hp = min(player.hp+20, 100);
    }
}

void combatSystem(Enemy enemy) {
    cout << "\n!! 遭遇战斗 !!" << endl;
    cout << "敌人:" << enemy.name << " (" << enemy.description << ")\n";
    
    while(enemy.hp > 0 && player.hp > 0) {
        // 玩家行动选择
        cout << "\n‌:ml-citation{ref="1" data="citationList"} 攻击  ‌:ml-citation{ref="2" data="citationList"} 防御  ‌:ml-citation{ref="3" data="citationList"} 使用物品";
        int choice;
        cin >> choice;

        // 战斗逻辑
        int damage = player.attack - (rand()%enemy.attack);
        if(damage > 0) {
            enemy.hp -= damage;
            cout << "你对" << enemy.name << "造成 " << damage << " 点伤害!\n";
        }
        // 敌人反击
        player.hp -= max(enemy.attack - player.defense, 0);
    }
    
    if(player.hp <=0 ) gameOver();
}

void gameOver() {
    cout << "\n██ 游戏结束 ██" << endl;
    exit(0);
}

public: void run() { srand(time(NULL)); cout << “输入角色名称:”; cin >> player.name;

代码
    // 剧情开场‌:ml-citation{ref="4" data="citationList"}
    cout << "\n██ 末世求生 ██\n";
    cout << player.name << "在核爆后的废墟中醒来...\n";
    system("pause");

    // 主游戏循环‌:ml-citation{ref="3" data="citationList"}
    while(day <= 7) {
        system("cls");
        showStatus();
        dayEvent();
        day++;
        system("pause");
    }

    // 结局分支‌:ml-citation{ref="7" data="citationList"}
    cout << "\n经过7天的生存,你终于找到避难所入口!";
    if(hasKey) {
        cout << "使用找到的钥匙开启大门...";
        cout << "██ 幸存结局 ██";
    } else {
        cout << "大门被牢牢锁住,追兵已至...";
        gameOver();
    }
}

};

int main() { StoryGame game; game.run(); return 0; }

https://www.luogu.com.cn/paste/pu683x2e 动态规划

代码
                https://www.luogu.com.cn/paste/4eqo1nzx链表


                https://www.luogu.me/  保存站

zorr.pro

溯洄https://129.211.13.155/

还没有收录这位用户的文章。