1 条题解

  • 0
    @ 2025-4-14 18:43:47

    Pascal :

    Const
      nums='0123456789ABCDEFGHIJ';
    Var
      i,b,sq10:longint;
      numb,sqb:string;
    Procedure convert(num:longint;Var s:string);
      Var
        m,n:longint;
      Begin
        m:=num div b;
        n:=num mod b;
        s:=nums[n+1]+s;
        If m<>0 then convert(m,s)
      End;
    Function check(num:string):boolean;
      Var
        flag:boolean;
        i,l:longint;
      Begin
        flag:=true;
        l:=length(num);
        For i:=1 to (l div 2) do
          If num[i]<>num[l+1-i] then
            Begin
              flag:=false;
              break
            End;
        exit(flag)
      End;
    Begin
      read(b);
      For i:=1 to 300 do
        Begin
          sqb:='';
          sq10:=sqr(i);
          convert(sq10,sqb);
          If check(sqb) then
            Begin
              numb:='';
              convert(i,numb);
              writeln(numb,' ',sqb)
            End
        End;
    End.
    
    • 1

    信息

    ID
    3253
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者