UOJ Logo

NOI.AC

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

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};
        }
    }
    for (int i = 1; i <= q; i++) {
        scanf("%lld", &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:22:22: error: expected unqualified-id before '[' token
                 auto [x, y] = mp[sub];\x0d
                      ^
answer.code:23:21: error: 'y' was not declared in this scope
                 a = y;\x0d
                     ^
answer.code:10:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld", &l, &q);\x0d
                              ^
answer.cod...