結果
| 問題 | No.2510 Six Cube Sum Counting |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2023-10-20 23:59:23 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1,458 ms / 4,000 ms |
| コード長 | 679 bytes |
| 記録 | |
| コンパイル時間 | 2,368 ms |
| コンパイル使用メモリ | 336,104 KB |
| 実行使用メモリ | 175,048 KB |
| 最終ジャッジ日時 | 2026-04-09 08:50:10 |
| 合計ジャッジ時間 | 45,107 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
#include "bits/stdc++.h"
#include <unordered_map>
#include <unordered_set>
using namespace std;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int x;
cin >> x;
unordered_map<int, int> mp;
int ans = 0;
for (int d = 0; d < 301; ++d) {
int c3 = d*d*d;
for (int b = 0; b < d + 1; ++b) {
int b3 = b * b * b;
for (int a = 0; a < b + 1; ++a) {
int tx = a * a * a + b3 + c3;
mp[tx]++;
}
}
int d3 = c3;
for (int e = d; e < 301; ++e) {
int e3 = e * e * e;
for (int f = e; f < 301; ++f) {
const int t = x - (d3 + e3 + f * f * f);
if (mp.find(t) == mp.end()) continue;
ans += mp[t];
}
}
}
cout << ans << endl;
}