UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#211397#3806. 逃跑LarryiaCompile Error//C++11830b2024-08-11 10:37:362024-08-11 13:03:08

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int m, n, k, x[10];
const int N = 2e5 + 10;
ll a[N][10];
ll dp(int s, int x[], int tr) {
    if (s == n + 1 || tr == 0) {
        ll ans = 0;
        for (int i = 1; i <= m; i++) {
            ans += abs(x[i]);  
        }
        return ans;
    }
    // 1.不选a[s]
    ll ans;
    for (int i = 1; i <= m; i++) {
        x[i] += a[s][i];
    }
    ans = dp(s + 1, x, tr);
    for (int i = 1; i <= m; i++) {
        x[i] -= a[s][i];
    }
    ans = max(ans, dp(s + 1, x, tr - 1));
    
    return ans;
}
int main() {
    scanf("%d%d%d", &n, &m, &k);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            scanf("%lld", &a[i][j]);
        }
    }
    prinf("%lld", dp(1, x, k));
    return 0;
}

详细

answer.code: In function 'int main()':
answer.code:35:30: error: 'prinf' was not declared in this scope
     prinf("%lld", dp(1, x, k));\x0d
                              ^
answer.code:29:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &n, &m, &k);\x0d
                                ^
answer.code:32:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unu...