-
个人简介
该用户太懒,这里啥也没写 (´・ω・`)
😀不活啦!!!新手小白请少少指教,哈哈哈, xhmc.2m.pub litt ``` bina...# *# 牢弟
骄傲使人进步落后,踏实才能落后进步
破釜沉舟,百二秦关终属楚, 苦心人天不负,卧薪尝胆,三千越甲可吞吴 学校是知识的海洋,所以我摸会鱼很正常。****** **从前有一种鱼叫做英鱼,它的身上有很多刺,名叫单刺。单刺分为很多种,分别是:名刺,形容刺,介刺,副刺,代刺。如果你英鱼没烤好,你就会被一种叫做家章的章鱼给制裁。😄 😄 😄 ****** 有同学问,要是出现了生化危机,感染者太多,手搓的AK扫不过来怎么办?你难道不会手搓一把榴弹炮来扩大范围伤害吗?黄埔课堂,手搓榴弹炮,开课! ...... 如果连这都不会,那就给我边蛙跳边上课! ...... 不管怎么说,手搓榴弹炮,有手就行。优势在我,下课!
·暴力出奇迹,骗分过样例。
·数学先打表,DP看运气。
·穷举TLE,递推UKE。
·模拟MLE,贪心还CE。
·想要骗到分,就要有方法。
·图论背模板,数论背公式。
·动规背方程,高精背代码。
·如果都没背,干脆输样例。
模拟只会猜题意,贪心只能过样例,
数学上来先打表,D P一般看规律。
组合数学靠运气,计算几何瞎暴力,
图论一顿套模板,数论只会GCD
网页版MC,免费😄(建议在Google上玩)
#include<bits/stdc++.h> using namespace std; int main() { int n,a[110],b[110]; cin>>n; for(int i=1; i<=n; i++) { cin>>a[i]; b[i]=i; } for(int i=1; i<=n-1; i++) { int mi1=300; int mi2=i; for(int j=i; j<=n; j++) { int student_id=b[j]; if(a[student_id]<mi1) { mi1=a[student_id]; mi2=j; } } swap(b[i],b[mi2]); for(int j=1; j<=n; j++) { cout<<b[j]; if(j<n)cout<<" "; } cout<<endl; } return 0; }
【入门】将n拆成3个数的和 #include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ for(int k=1;k<=n;k++){ if(i+j+k==n&&i<=j&&j<=k){ printf("%d=%d+%d+%d",n,i,j,k); cout<<endl; } } } } return 0; }
【入门】九头鸟 #include <bits/stdc++.h> using namespace std; int s; int main(){ for(int i=1;i<=100/9;i++){ for(int j=1;j<=100-i;j++){ int k=100-i9-j; if(i9+j+k100&&i2+j2+k*4100&&k>0){ s++; cout<<i<<" "<<j<<" "<<k<<endl; } } } cout<<s; return 0; } 【基础】三色球问题 #include using namespace std;
int main() { int count=0; for (int red=0;red<=3;red++) { for (int white=0;white<=3;white++) { int black=8-red-white; if (black>=0&&black<=6) { count++; } } } cout<<count<< endl; return 0; } 【入门】编程求1+1/2+1/3+...+1/n #include <bits/stdc++.h> using namespace std; int main(){ int n; double sos,S=0.0; cin>>n; for(int i=1;i<=n;i++){ sos=1.0/i; S+=sos; } printf("%.3lf",S); return 0; } 求零件个数 #include <bits/stdc++.h> using namespace std; int main(){ for(int i = 100; ; i++) { if (i % 3 == 2&&i % 5 == 3&&i % 7 == 5) { cout<<i; break; } }
return 0;} play.mc.js.cool/1.8/ play1.mc.js.cool/1.8/ play2.mc.js.cool/1.8/
我的世界(首发) 要用C++11
#include <bits/stdc++.h> #include //STL 位集容器 #include #include #include #include #include //复数类 #include #include #include #include #include //STL 双端队列容器 #include //异常处理类 #include #include //STL 定义运算函数(代替运算符) #include #include //STL 线性列表容器 #include //STL 映射容器 #include #include //基本输入/输出支持 #include //输入/输出系统使用的前置声明 #include #include //基本输入流 #include //基本输出流 #include //STL 队列容器 #include //STL 集合容器 #include //基于字符串的流 #include //STL 堆栈容器 #include //标准异常类 #include //底层输入/输出支持 #include //字符串类 #include //STL 通用模板类 #include //STL 动态数组容器 #include #include #include <windows.h> using namespace std;
// 控制台颜色定义 (兼容Dev-C++) #define BLACK 0 #define BLUE 1 #define GREEN 2 #define CYAN 3 #define RED 4 #define MAGENTA 5 #define BROWN 6 #define LIGHTGRAY 7 #define DARKGRAY 8 #define LIGHTBLUE 9 #define LIGHTGREEN 10 #define LIGHTCYAN 11 #define LIGHTRED 12 #define LIGHTMAGENTA 13 #define YELLOW 14 #define WHITE 15
// 游戏常量 const int WORLD_WIDTH = 60; const int WORLD_HEIGHT = 30; const int VIEW_DISTANCE = 10; const int INVENTORY_SIZE = 9;
// 方块类型枚举 enum BlockType { AIR, STONE, DIRT, GRASS, WOOD, LEAVES, WATER, SAND, GLASS, COBBLESTONE, BRICK, BEDROCK };
// 方块属性结构体 struct BlockProperties { string name; int color; bool solid; bool transparent; };
// 物品类型枚举 enum ItemType { ITEM_NONE, ITEM_STONE, ITEM_DIRT, ITEM_GRASS_BLOCK, ITEM_WOOD, ITEM_LEAVES, ITEM_SAND, ITEM_GLASS, ITEM_COBBLESTONE, ITEM_BRICK };
// 物品结构体 struct InventoryItem { ItemType type; int quantity; };
// 游戏状态枚举 enum GameState { STATE_PLAYING, STATE_INVENTORY };
// 玩家类 class Player { public: float x, y; float velocityY; bool isFlying; InventoryItem inventory[INVENTORY_SIZE]; int selectedSlot;
Player() : x(0), y(0), velocityY(0), isFlying(false), selectedSlot(0) { // 初始化物品栏 for (int i = 0; i < INVENTORY_SIZE; i++) { inventory[i].type = ITEM_NONE; inventory[i].quantity = 0; } // 初始物品 inventory[0] = {ITEM_GRASS_BLOCK, 64}; inventory[1] = {ITEM_DIRT, 64}; inventory[2] = {ITEM_STONE, 64}; } void updatePosition(World&world); void jump(World& world); void addToInventory(ItemType item, int quantity = 1);};
// 世界类 class World { private: BlockType blocks[WORLD_HEIGHT][WORLD_WIDTH];
public: World() { generateWorld(); }
void generateWorld(); void render(int playerX, int playerY); BlockType getBlock(int x, int y) const; void setBlock(int x, int y, BlockType type); bool isSolid(int x, int y) const; bool isTransparent(int x, int y) const;};
// 设置控制台颜色函数 void setColor(int text, int background = BLACK) { HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(hConsole, (WORD)((background << 4) | text)); }
// 获取方块属性 BlockProperties getBlockProperties(BlockType type) { static map<BlockType, BlockProperties> properties = { {AIR, {"空气", BLACK, false, true}}, {STONE, {"石头", DARKGRAY, true, false}}, {DIRT, {"泥土", BROWN, true, false}}, {GRASS, {"草方块", GREEN, true, false}}, {WOOD, {"木头", BROWN, true, false}}, {LEAVES, {"树叶", GREEN, false, true}}, {WATER, {"水", BLUE, false, true}}, {SAND, {"沙子", YELLOW, true, false}}, {GLASS, {"玻璃", LIGHTCYAN, true, true}}, {COBBLESTONE, {"圆石", DARKGRAY, true, false}}, {BRICK, {"砖块", RED, true, false}}, {BEDROCK, {"基岩", BLACK, true, false}} }; return properties[type]; }
// 世界生成 void World::generateWorld() { srand(time(0));
// 生成地形层 for (int x = 0; x < WORLD_WIDTH; x++) { int groundHeight = WORLD_HEIGHT * 2 / 3 + (rand() % 5 - 2); for (int y = 0; y < WORLD_HEIGHT; y++) { if (y > groundHeight) { // 地下层 if (y == WORLD_HEIGHT - 1) { blocks[y][x] = BEDROCK; } else if (y > groundHeight + 5) { blocks[y][x] = STONE; } else { blocks[y][x] = DIRT; } } else if (y == groundHeight) { blocks[y][x] = GRASS; } else if (y < groundHeight) { blocks[y][x] = AIR; } } } // 添加一些树 for (int i = 0; i < 5; i++) { int treeX = 5 + rand() % (WORLD_WIDTH - 10); int groundY = 0; // 找到地面高度 for (int y = 0; y < WORLD_HEIGHT; y++) { if (getBlock(treeX, y) == GRASS) { groundY = y; break; } } // 生成树干(4-6格高) int treeHeight = 4 + rand() % 3; for (int y = groundY - 1; y >= groundY - treeHeight && y >= 0; y--) { setBlock(treeX, y, WOOD); } // 生成树叶 for (int dy = -2; dy <= 0; dy++) { for (int dx = -2; dx <= 2; dx++) { if (abs(dx) + abs(dy) <= 3 && treeX + dx >= 0 && treeX + dx < WORLD_WIDTH && groundY - treeHeight + dy >= 0) { setBlock(treeX + dx, groundY - treeHeight + dy, LEAVES); } } } } // 添加一个小湖 for (int x = 15; x < 25; x++) { for (int y = WORLD_HEIGHT * 2 / 3 - 3; y < WORLD_HEIGHT * 2 / 3; y++) { if (y == WORLD_HEIGHT * 2 / 3 - 3) { setBlock(x, y, SAND); } else { setBlock(x, y, WATER); } } }}
// 世界渲染 void World::render(int playerX, int playerY) { int startX = max(0, playerX - VIEW_DISTANCE); int endX = min(WORLD_WIDTH - 1, playerX + VIEW_DISTANCE); int startY = max(0, playerY - VIEW_DISTANCE); int endY = min(WORLD_HEIGHT - 1, playerY + VIEW_DISTANCE);
for (int y = startY; y <= endY; y++) { for (int x = startX; x <= endX; x++) { BlockType block = getBlock(x, y); BlockProperties props = getBlockProperties(block); setColor(props.color); // 简单的方块表示 switch(block) { case AIR: cout << " "; break; case STONE: cout << "#"; break; case DIRT: cout << "="; break; case GRASS: cout << "*"; break; case WOOD: cout << "T"; break; case LEAVES: cout << "%"; break; case WATER: cout << "~"; break; case SAND: cout << "."; break; case GLASS: cout << "O"; break; case COBBLESTONE: cout << "C"; break; case BRICK: cout << "B"; break; case BEDROCK: cout << "X"; break; default: cout << "?"; break; } } cout << endl; } setColor(WHITE);}
// 获取方块 BlockType World::getBlock(int x, int y) const { if (x < 0 || x >= WORLD_WIDTH || y < 0 || y >= WORLD_HEIGHT) return BEDROCK; return blocks[y][x]; }
// 设置方块 void World::setBlock(int x, int y, BlockType type) { if (x >= 0 && x < WORLD_WIDTH && y >= 0 && y < WORLD_HEIGHT) { blocks[y][x] = type; } }
// 判断方块是否固体 bool World::isSolid(int x, int y) const { return getBlockProperties(getBlock(x, y)).solid; }
// 判断方块是否透明 bool World::isTransparent(int x, int y) const { return getBlockProperties(getBlock(x, y)).transparent; }
// 玩家位置更新 void Player::updatePosition(World& world) { // 简单重力 if (!isFlying) { if (!world.isSolid((int)x, (int)y + 1)) { velocityY += 0.1f; y += velocityY; } else { velocityY = 0; // 对齐到方块上方 y = (int)y; } }
// 边界检查 x = max(0.0f, min((float)WORLD_WIDTH - 1, x)); y = max(0.0f, min((float)WORLD_HEIGHT - 1, y));}
// 玩家跳跃 void Player::jump(World& world) { if (!isFlying && world.isSolid((int)x, (int)y + 1)) { velocityY = -1.5f; } }
// 添加物品到物品栏 void Player::addToInventory(ItemType item, int quantity) { // 先检查是否已有相同物品 for (int i = 0; i < INVENTORY_SIZE; i++) { if (inventory[i].type == item) { inventory[i].quantity += quantity; return; } }
// 找空位 for (int i = 0; i < INVENTORY_SIZE; i++) { if (inventory[i].type == ITEM_NONE) { inventory[i].type = item; inventory[i].quantity = quantity; return; } }}
// 渲染HUD void renderHUD(Player& player) { setColor(WHITE); cout << "坐标: (" << (int)player.x << ", " << (int)player.y << ")" << endl;
// 显示物品栏 cout << "物品栏: "; for (int i = 0; i < INVENTORY_SIZE; i++) { if (i == player.selectedSlot) { setColor(YELLOW, DARKGRAY); } else { setColor(WHITE, DARKGRAY); } if (player.inventory[i].type != ITEM_NONE) { cout << "[" << player.inventory[i].quantity << "]"; } else { cout << "[ ]"; } } setColor(WHITE); cout << endl << "WASD:移动 空格:跳跃 E:打开物品栏 Q:放置方块 F:飞行模式" << endl;}
// 处理输入 void handleInput(char input, Player& player, World& world) { switch(tolower(input)) { case 'w': player.y -= 1; break; case 's': player.y += 1; break; case 'a': player.x -= 1; break; case 'd': player.x += 1; break; case ' ': player.jump(world); break; case 'e': /* 打开物品栏 */ break; case 'f': player.isFlying = !player.isFlying; break; case 'q': { // 放置方块 ItemType selectedItem = player.inventory[player.selectedSlot].type; if (selectedItem != ITEM_NONE) { BlockType blockToPlace = AIR; switch(selectedItem) { case ITEM_GRASS_BLOCK: blockToPlace = GRASS; break; case ITEM_DIRT: blockToPlace = DIRT; break; case ITEM_STONE: blockToPlace = STONE; break; case ITEM_WOOD: blockToPlace = WOOD; break; case ITEM_LEAVES: blockToPlace = LEAVES; break; case ITEM_SAND: blockToPlace = SAND; break; case ITEM_GLASS: blockToPlace = GLASS; break; case ITEM_COBBLESTONE: blockToPlace = COBBLESTONE; break; case ITEM_BRICK: blockToPlace = BRICK; break; default: break; }
if (blockToPlace != AIR) { world.setBlock((int)player.x, (int)player.y, blockToPlace); player.inventory[player.selectedSlot].quantity--; if (player.inventory[player.selectedSlot].quantity <= 0) { player.inventory[player.selectedSlot].type = ITEM_NONE; } } } break; } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': player.selectedSlot = input - '1'; break; }}
// 主游戏循环 void gameLoop() { World world; Player player;
// 初始位置 player.x = WORLD_WIDTH / 2; player.y = 5; while (true) { // 处理输入 if (_kbhit()) { char input = _getch(); handleInput(input, player, world); } // 更新游戏状态 player.updatePosition(world); // 渲染 system("cls"); world.render((int)player.x, (int)player.y); renderHUD(player); // 控制帧率 Sleep(50); }}
int main() { // 设置控制台窗口大小 system("mode con cols=80 lines=40");
// 开始游戏 gameLoop(); return 0;}
-
最近活动
- 寒假_进阶班_6_综合测试 作业
- 寒假大礼包 作业
- 2025南海区赛_小学组 作业
- 周三晚_刷题班_完结篇 OI
- 南海区赛_最终模拟_COPY版本 作业
- 元旦区赛加练 OI
- 南海区赛_易错点测试题 OI
- 南海区赛_最终模拟 OI
- 王老师_区赛模拟3 OI
- 区赛_综合复习 作业
- 王老师_区赛复习9 作业
- 王老师_C++区赛模拟2 OI
- ZXY专项练习 作业
- 王老师_二分查找+二分答案复习 作业
- 王老师_区赛复习8 作业
- 王老师_C++区赛模拟1 OI
- 王老师_区赛复习7 作业
- 区赛真题练习 作业
- 南海区赛_小学组_历年_第三、四题 作业
- 王老师_区赛复习6_二分查找 作业
- 南海区赛_小学组_历年_前两题 作业
- 王老师_区赛复习5 ACM/ICPC
- 王老师_区赛复习4_COPY版本 作业
- 王老师_区赛复习 4 OI
- 王老师_区赛复习3_COPY版本 作业
- 王老师_区赛复习1_COPY版本 作业
- 王老师_区赛复习1 OI
- 周三三人小组作业7_赛后评讲 作业
- 王老师_班级小测 作业
- 王老师_尺取法1班级 作业
- 王老师_区间贪心 作业
- 王老师_班级小练2 作业
- 王老师_班级小练 作业
- 一维差分 作业
- 王老师_国庆班级2_第三次课_贪心专题 作业
- 王老师_国庆班级2_第一次课_质数专题 作业
- 王老师_国庆班级1_第三次课_综合性测试+讲解 作业
- 王老师_国庆班级1_第二次课_二维前缀和+二维差分 作业
- 王老师_国庆班级1_第一次课_简单贪心 作业
- 王老师班级_阶段性小测 作业
- CSP 2025 J1 ACM/ICPC
- 一维数组连续性问题+多次遍历 作业
- 一维数组 作业
- 王老师_结构体排序+递推 作业
- 王老师_结构体+函数+进制转换+连续性问题 作业
-
Stat
-
Rating