結果
問題 |
No.2510 Six Cube Sum Counting
|
ユーザー |
|
提出日時 | 2023-10-20 23:59:23 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3,010 ms / 4,000 ms |
コード長 | 679 bytes |
コンパイル時間 | 2,963 ms |
コンパイル使用メモリ | 248,876 KB |
実行使用メモリ | 174,900 KB |
最終ジャッジ日時 | 2024-09-21 00:22:50 |
合計ジャッジ時間 | 94,830 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; }