begin
library A6, A12;
integer i, j, k, n, r, s, t1, layout1, layout2;
boolean p;
integer array d[1:10];


   integer procedure clock;
      kdf9 2/0/0/0;
      SET 17; OUT; REV; ERASE; SHL-24; exit 
      algol 

layout1 := format({ndddddddss});
layout2 := format({ndddddddddc});
open(30);
t1 := clock;

n := 0;

REPEAT1:

   n := n + 1; s := n*n; k := 0;
   REPEAT2:
      k := k + 1; r := s !div 10;
      d[k] := s - r*10; s := r;
      if s ne 0 then goto REPEAT2;

   i := 1; j := k;

   REPEAT3:
      p := d[i] = d[j];
      i := i + 1; j := j - 1;
      if p and i < j then goto REPEAT3;

   if p then
      begin write(30, layout1, n); write(30, layout2, n*n) end 

   if n < 32768 then goto REPEAT1;

writetext(30, {{cc}CPU _ time _ in _ seconds:}); write(30, layout2, clock - t1);
close(30);
end
|