http://oj.acm.zstu.edu.cn/JudgeOnline/problem.php?cid=4034&pid=0

C++版本一

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<string.h>
using namespace std;
 
int main(){
    int i,c,a,b;
    while(~scanf("%d",&c)){
        b=1;
        a=1;
        long long TS=b*b*b-a*a*a;
        int flag=0;
        while(TS!=c){
            if(TS>c)a++;
            else b++;
            TS=b*b*b-a*a*a;
            if(TS>c&&b-a==1){
                flag=1;
                break;
            }
        }
        if(flag)printf("-1\n");
        else printf("%d %d\n",a,b);
    }
    return 0;
}