ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213094 | #2348. Life | KXG | Compile Error | / | / | C++11 | 830b | 2024-11-09 19:55:53 | 2024-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...