// aarifshuvo ``CSEJU #include <bits/stdc++.h> #define ll long long #define SZ(x) ((int)(x).size()) #define scl(x) scanf("%lld", &x) #define scll(x,y) scanf("%lld %lld", &x, &y) #define ALL(x) (x).begin(),(x).end() #define REP(i,n) for(int i=0;i<n;i++) #define REV(i,n) for(int i=n-1;i>=0;i--) #define FOR(i,a,b) for(int i=a;i<=b;i++) #define pri(a) cout<<a<<endl #define prii(a,b) cout<<a<<" "<<b<<endl using namespace std; ll n, mem[22][10009];; ll ar[23]; ll call(ll i, ll feas) { if(feas==0) return 1; if(i==21) return 0; ll &ret = mem[i][feas]; if(~ret) return ret; ret = 0; for(int j=0; feas-ar[i]*j>=0; j++) { ret += call(i+1,feas-ar[i]*j); } return ret; } int main() { REP(i,21) ar[i]=(i+1)*(i+1)*(i+1); memset(mem,-1,sizeof mem); while(scl(n)==1) { ll res = call(0,n); printf("%lld\n", res); } return 0; }
~Be glad of life because it gives you the chance to love and to work and to play and to look at the stars.~
Thursday, June 1, 2017
Uva 11137 Ingenuous Cubrency
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment