全部评论 6

  • 珍贵的史料没了(悲

    2026-07-27 来自 上海

    2
  • NO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    2026-07-27 来自 广东

    1
  • 迷宫(特别好玩)

    #include <iostream>
    #include <cstdlib>
    #include <ctime>
    #include <vector>
    #include <queue>
    #include <algorithm>
    #include <conio.h>
    #include <windows.h>
    using namespace std;
    
    /* 三维迷宫参数 */
    const int LAYERS = 3;           // 层数
    const int H = 37;               // 高度(奇数)
    const int W = 67;               // 宽度(奇数)
    
    char maze[LAYERS][H][W];        // 地图,字符含义见下
    int playerX, playerY, playerZ;  // 玩家位置 (x列, y行, z层)
    int keys = 0;                   // 已持有钥匙数
    
    /* 字符说明:
     * '#' 墙/障碍物
     * ' ' 路
     * 'K' 钥匙
     * 'D' 门(需钥匙才能通过)
     * 'E' 出口(仅第3层)
     * '>' 下行楼梯(通向下一层)
     * '<' 上行楼梯(通向上一层)
     * '@' 玩家(动态显示)
     */
    
    struct Point {
        int x, y;
        Point() {}
        Point(int a, int b) : x(a), y(b) {}
    };
    
    // 四个方向:上,右,下,左
    const int dx[4] = {0, 1, 0, -1};
    const int dy[4] = {-1, 0, 1, 0};
    
    // 随机打乱方向,用于迷宫生成
    void shuffleDir(int dirs[]) {
        for (int i = 0; i < 4; ++i) dirs[i] = i;
        for (int i = 0; i < 4; ++i) {
            int j = rand() % 4;
            swap(dirs[i], dirs[j]);
        }
    }
    
    /* 递归深度优先生成迷宫 (从已设为路的起点开始) */
    void dfsMaze(int z, int x, int y) {
        int dirs[4];
        shuffleDir(dirs);
        for (int i = 0; i < 4; ++i) {
            int nx = x + dx[dirs[i]] * 2;
            int ny = y + dy[dirs[i]] * 2;
            if (nx > 0 && nx < W - 1 && ny > 0 && ny < H - 1 && maze[z][ny][nx] == '#') {
                // 打通中间墙
                maze[z][y + dy[dirs[i]]][x + dx[dirs[i]]] = ' ';
                maze[z][ny][nx] = ' ';
                dfsMaze(z, nx, ny);
            }
        }
    }
    
    /* 生成一层的迷宫,全墙,从 (sx, sy) 开始挖路 */
    void generateLayer(int z, int sx, int sy) {
        for (int i = 0; i < H; ++i)
            for (int j = 0; j < W; ++j)
                maze[z][i][j] = '#';
        maze[z][sy][sx] = ' ';
        dfsMaze(z, sx, sy);
    }
    
    /* BFS 寻路,返回从 (sx,sy) 到 (ex,ey) 的路径坐标(含起止点) */
    vector<Point> bfsPath(int z, int sx, int sy, int ex, int ey) {
        vector<vector<bool> > visited(H, vector<bool>(W, false));
        vector<vector<Point> > prev(H, vector<Point>(W, Point(-1, -1)));
        queue<Point> q;
        q.push(Point(sx, sy));
        visited[sy][sx] = true;
    
        while 
    

    2026-07-30 来自 广东

    0
  • ac1/4

    #include <bits/stdc++.h>
    using namespace std;
    
    int main() {
        int n, m, k;
        cin >> n >> m >> k;
        
        int a[55][55];
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                cin >> a[i][j];
            }
        }
        
        long long dp[55][55] = {0};
        dp[1][1] = a[1][1];
        
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                if (i == 1 && j == 1) continue;
                if (i == 1) {
                    dp[i][j] = dp[i][j-1] + a[i][j];
                } else if (j == 1) {
                    dp[i][j] = dp[i-1][j] + a[i][j];
                } else {
                    dp[i][j] = max(dp[i-1][j], dp[i][j-1]) + a[i][j];
                }
            }
        }
        
        cout << dp[n][m];
        return 0;
    }
    

    2026-07-30 来自 广东

    0
  • #include <bits/stdc++.h>
    using namespace std;
    
    int main() {
        int q;
        cin >> q;
        
        int a = 0, b = 0;
        
        while (q--) {
            int k, x, y;
            cin >> k >> x >> y;
            
            if (k == 1) {
                a = x;
                b = y;
            } else if (k == 2) {
                a += x;
                b += y;
            } else {
                int na = a * x - b * y;
                int nb = a * y + b * x;
                a = na;
                b = nb;
            }
            
            cout << a;
            if (b >= 0) cout << "+";
            cout << b << "i" << endl;
        }
        
        return 0;
    }
    

    2026-07-30 来自 广东

    0
  • #include<bits/stdc++.h>
    using namespace std;
    int main(){
        int x;
        cin>>x;
        int a[4];
        int id = 0;
        //数位分离
        while (x > 0) {
            a[id++] =x%10;
            x/=10;
        }
        //将4位数字从小到大排序
        sort(a,a+4);
        //让最小的两位数 成为十位,其余为个位
        int ans = 10 * (a[0] + a[1]) + a[2] + a[3];
        cout<<ans;
        return 0;
    }
    

    2026-07-30 来自 广东

    0

热门讨论