#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <stack>
#include <cmath>
#include <deque>
#include <queue>
#include <list>
#include <set>
#include <map>
#define mem(a, b) memset(a, b, sizeof(a))
#define pi acos(-1)
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
pair<ll , ll> ans;
ll get(ll x){
return x*x*x;
}
void dfs(ll m, ll step, ll x){
if(m == 0){
ans = max(ans, make_pair(step, x));
return;
}
ll pos = 1;
while(get(pos) <= m){
pos++;
}
pos--;
dfs(m-get(pos), step+1, x+get(pos));
dfs(get(pos)-1-get(pos-1), step+1, get(pos-1)+x);
}
int main(){
ll m;
scanf("%lld", &m);
dfs(m, 0, 0);
printf("%lld %lld\n", ans.first, ans.second);
}
CodeForces - 679B(dfs)
猜你喜欢
转载自blog.csdn.net/yanhu6955/article/details/82916634
今日推荐
周排行