编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#5212 #1033. 电子钱包 Compile Error 0 0 ms 0 K C++ 17 (Clang) / 838 B t330026229 2024-02-25 16:58:51
显示原始代码
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, m, k, a[50][N], ans = 0, row[50];
void dfs(int cur, int oup) {
    if (cur > m - k + 1) {
        ans = max(ans, oup);
        return;
    }
    for (int i = 1; i <= n; i++) {
        if (row[i] == 0) {
            for (int j = cur; j <= cur + k - 1 && j <= m; j++) {
                oup += a[i][j];
                int temp = a[x][y];
                row[i] = 1, a[x][y] = 0;
                dfs(cur + 1, oup);
                row[i] = 0, a[x][y] = temp;
                oup -= a[i][j];
            }
        }
    }
}
int main() {
    scanf("%d%d%d", &n, &m, &k);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            scanf("%d", &a[i][j]);
        }
    }
    dfs(1, 0);
    printf("%d\n", ans);
    return 0;
}

编译信息

/sandbox/1/a.cpp:19:28: error: use of undeclared identifier 'x'
                int temp=a[x][y];
                           ^
/sandbox/1/a.cpp:19:31: error: use of undeclared identifier 'y'
                int temp=a[x][y];
                              ^
/sandbox/1/a.cpp:20:29: error: use of undeclared identifier 'x'
                row[i]=1, a[x][y]=0;
                            ^
/sandbox/1/a.cpp:20:32: error: use of undeclared identifier 'y'
                row[i]=1, a[x][y]=0;
                               ^
/sandbox/1/a.cpp:22:29: error: use of undeclared identifier 'x'
                row[i]=0, a[x][y]=temp;
                            ^
/sandbox/1/a.cpp:22:32: error: use of undeclared identifier 'y'
                row[i]=0, a[x][y]=temp;
                               ^
6 errors generated.