http://acm.hit.edu.cn/hoj/problem/view?id=2201
"For each test case, output two integers x and y such that x^3 + y^3 = n"
要考虑负数
另外578^3-577^3=1000519
无脑打表流
数组用int型会失精
#include <stdio.h>
#include <math.h>
int main()
{
double ans[1200];
int i, j, k;
int n, flag;
for (i = -600; i < 600; i++)
ans[600+i] = pow(i,3);
while (scanf("%d", &n) && n)
{
flag = 0;
for (j = 0; j < 1200; j++)
{
for (k = j; k < 1200; k++)
{
if (n == ans[j] + ans[k])
{
printf("%d %d\n", j-600, k-600);
flag = 1;
break;
}
}
if (flag == 1)
break;
}
if(flag == 0)
printf("impossible\n");
}
return 0;
}