记录编号 109403 评测结果 AAAAAAAA
题目名称 回文平方数 最终得分 100
用户昵称 GravatarFoolMike 是否通过 通过
代码语言 Pascal 运行时间 0.002 s
提交时间 2014-07-08 17:19:39 内存使用 0.17 MiB
显示代码纯文本
var
a,b,d,e,f,g:longint;
c:array[1..17]of longint;
z:array[1..9]of longint;
begin
assign(input,'palsquare.in');
assign(output,'palsquare.out');
reset(input);
rewrite(output);
read(b);
d:=0;
for a:=1 to 300 do
begin
d:=d+2*a-1;
c[1]:=d;
for e:=1 to 16 do
begin
c[e+1]:=c[e] div b;
c[e]:=c[e] mod b;
end;

e:=17;
while c[e]=0 do dec(e);
f:=0;
for g:=1 to e div 2 do
if c[g]<>c[e-g+1] then
begin
f:=1;
break;
end;

if f=0 then
begin
z[1]:=a;
for g:=1 to 8 do
begin
z[g+1]:=z[g] div b;
z[g]:=z[g] mod b;
end;
while z[g]=0 do dec(g);
for g:=g downto 1 do
if z[g]<10 then write(z[g])
  else write(chr(z[g]+55));
  write(' ');
for e:=1 to e do
if c[e]<10 then write(c[e])
  else write(chr(c[e]+55));
writeln;
end;
end;
close(input);close(output);
end.