main () { FILE *fin = fopen ("palsquare.in", "r"); FILE *fout = fopen ("palsquare.out", "w"); int bas; fscanf (fin, "%d", &bas); int i,j; bsn an,a2; for(i=1;i<=maxn;i++){ an=ton(i,bas); a2=ton(i*i,bas); if(isp(&a2)) fprintf (fout, "%s %s\n", an.rep, a2.rep); } exit (0); }
int agari::hansuu(int dora){ int num=0; if(mentsu[0]==KOKUSHI){ num=13; return num; } if(mentsu[0]==TITOI){ num+=2; if(titoi_tuiso()){ num=13; return num; } if(titoi_tanyao()) num++; if(titoi_tinitsu()) num+=6; else if(titoi_honitsu()) num+=3; if(titoi_honroutou()) num+=2; num++; return num; } if(tinroutou()) num+=13; if(daisangen()) num+=13; if(tuiso()) num+=13; if(daisusi()){ num+=13; }else if(syoususi()) num+=13; if(ryuiso()) num+=13; if(suanko()) num+=13; if(tyuren()) num+=13; if(num>=13){ return num; } if(ton()) num+=2; if(hatsu()) num++; if(haku()) num++; if(tyun()) num++; if(pinhu()){ num++; } if(tanyao()) num++; if(zyuntyan()) num+=3; else if(honroutou()) num+=2; else if(tyanta()) num+=2; if(ikkitukan()) num+=2; if(sansyokudoukou()) num+=2; if(sansyokudouzyun()) num+=2; if(toitoi()) num+=2; if(sanankou()) num+=2; if(syousangen()) num+=2; if(ryanpeko()){ num+=3; }else if(ipeko()) num++; if(tinitsu()){ num+=6; }else if(honitsu()) num+=3; num+=count_dora(dora); num++; return num; }