/* -*- coding: utf-8 -*- * * 2510.cc: No.2510 Six Cube Sum Counting - yukicoder */ #include #include #include using namespace std; /* constant */ const int MAX_A = 300; const int BN = 9 * 10; /* typedef */ using mii = map; /* global variables */ /* subroutines */ /* main */ int main() { int x; scanf("%d", &x); __int128 msk = (1 << 9) - 1; mii scs; int cnt = 0; for (int a = 0; a <= MAX_A; a++) { int a3 = a * a * a; for (int b = a; b <= MAX_A; b++) { int b3 = b * b * b; for (int c = b; c <= MAX_A; c++) { int s = a3 + b3 + c * c * c; if (s * 2 <= x) { auto mit = scs.find(s); if (mit == scs.end()) { __int128 bt = ~msk | c; scs[s] = bt; } else { mit->second = (mit->second << 9) | c; } } if (x >= s && s * 2 >= x) { auto mit = scs.find(x - s); if (mit != scs.end()) { __int128 bt = mit->second; for (;;) { int c = bt & msk; if (c == msk) break; if (c <= a) cnt++; bt >>= 9; } } } } } } printf("%d\n", cnt); return 0; }