#include
int main()
{
int x = 1, y = 1;
for (; x <= 100; x++) {
for (y = 1; y <= 100; y++) {
if (x*x + 2*x == y*y*y)
printf("(x, y) = (%d, %d)\n", x, y);
}
}
}
#include "stdio.h"
int main(void){
int x,y;
for(y=1;y<22;y++)
for(x=1;x<101;x++)
if(x*x+(x<<1)==y*y*y)
printf("x = %d\ty = %d\n",x,y);
return 0;
}
写两层循环,算10000次就出来了