Beispiel #1
0
int main () {
    FILE *fin  = fopen ("palsquare.in", "r");
    FILE *fout = fopen ("palsquare.out", "w");    

    int B;
    fscanf(fin, "%d", &B);

    int N;
    int square;
    for (N = 1; N <= 300; N++) {
        square = N * N;
        char* square_B = ten_to_B(square, B);

        if (is_palidrome(square_B)) {
            char* N_B = ten_to_B(N, B);
            fprintf(fout, "%s %s\n", N_B, square_B);

            free(N_B);
            free(square_B);
        }
    }

    fclose(fin);
    fclose(fout);
    return 0;
}
Beispiel #2
0
int main(){
  int result = 0;

  for(int i = 100; i < 1000; ++i)
    for(int j = 100; j < 1000; ++j){
      int temp = i * j;
      if(is_palidrome(temp))
	if(result < temp)
	  result = temp;
    }

  std::cout << result << std::endl;
}