UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#213093#2348. LifeKXGCompile Error//C++11864b2024-11-09 19:55:112024-11-09 23:09:00

answer

#include <cstdio>
#include <unordered_map>
using namespace std;
unordered_map<long long, pair<int, int> > mp;
long long l, q, x;
long long calc(long long x) {
    return x * x * x;
}
int main() {
    scanf("%lld%lld", &l, &q);
    for (int i = -l; i <= l; i++) {
        for (int j = -l; j <= l; j++) {
            mp[calc(i) + calc(j)] = {i, j};
        }
    }
    printf("OK\n");
    return 0;
    for (int i = 1; i <= q; i++) {
        scanf("%d", &x);
        int a = l + 1, b = l + 1, c = l + 1;
        for (int j = -l; j <= l; j++) {
            long long sub = x - calc(j);
            if (mp.count(sub)) {
                auto [x, y] = mp[sub];
                a = y;
                b = x;
                c = j;
                break;
            }
        }
        printf("%d %d %d\n", a, b, c);
    }
    return 0;
}

详细

answer.code: In function 'int main()':
answer.code:19:23: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
         scanf("%d", &x);\x0d
                       ^
answer.code:24:22: error: expected unqualified-id before '[' token
                 auto [x, y] = mp[sub];\x0d
                      ^
answer.code:25:21: error: 'y' was not declared in this scope
                 a = y;\x0d
                     ^
answer.code:10:30: warning: ignoring retur...