Untitled
unknown
plain_text
a year ago
945 B
6
Indexable
#include <iostream> using namespace std; const int MN = 125000; int t, n; const int k = 5; //long long memo[60][5][MN]; long long dp(int i, int cnt, int s) { if (s > n) { return 0; } if (cnt == k) { return s == n; } //if (memo[i][cnt][s] != -1) { // return memo[i][cnt][s]; //} long long ans = 0; for (long long j = i; j*j*j <= n; ++j) { ans += dp(j, cnt + 1, s + j*j*j); } return /*memo[i][cnt][s] =*/ ans; } int main() { cin >> t; for (int test_case = 1; test_case <= t; ++test_case) { cin >> n; /* for (int i = 0; i < 60; ++i) { for (int j = 0; j <= n; ++j) { memo[i][0][j] = -1; memo[i][1][j] = -1; memo[i][2][j] = -1; memo[i][3][j] = -1; memo[i][4][j] = -1; } }*/ cout << "#" << test_case << " " << dp(0, 0, 0) << '\n'; } return 0; }
Editor is loading...
Leave a Comment