/* * abc : xyz --> ax by cz * * Etual / Etual@163.com * 2009-7-1 */
#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <math.h>
int analyze(int abc,int xyz,int *ax,int *by,int *cz) { *ax = (abc/100)*10+(xyz/100); abc = abc % 100; xyz = xyz % 100;
*by = (abc/10)*10+(xyz/10); abc = abc % 10; xyz = xyz % 10;
*cz = abc*10+xyz;
return 0; }
int main(int argc,char *argv[]) { int a,b,c; int arry[22]; int i,j;
for(i=10;i<32;i++) arry[i-10]=i*i;
for(i=0;i<22;i++) for(j=0;j<22;j++) { analyze(arry[i],arry[j],&a,&b,&c); if( sqrt(a) == (int)sqrt(a) && sqrt(b) == (int)sqrt(b) && sqrt(c) == (int)sqrt(c) ) printf("\n find: %d and %d : \ \n %d ,%d ,%d",arry[i],arry[j],a,b,c); }
printf("\n");
return 0; }
|