#include<stdio.h>
int main()
{
int i,j,n,x,y;
while(scanf("%d", &n) && n>0 && n<=10000)
{
x = n, y = n;
for(i=1;i<=58;i++)
{
for(j=0;j<i;j++)
{
if((i*i*i) - (j*j*j) == n)
{
if(j<y)
{
x = i;
y = j;
}
}
}
}
if(x != n && y != n)
printf("%d %d\n", x, y);
else
printf("No solution\n");
}
return 0;
}
int main()
{
int i,j,n,x,y;
while(scanf("%d", &n) && n>0 && n<=10000)
{
x = n, y = n;
for(i=1;i<=58;i++)
{
for(j=0;j<i;j++)
{
if((i*i*i) - (j*j*j) == n)
{
if(j<y)
{
x = i;
y = j;
}
}
}
}
if(x != n && y != n)
printf("%d %d\n", x, y);
else
printf("No solution\n");
}
return 0;
}
Comments
Post a Comment