1 solutions

  • 0
    @ 2025-11-5 16:53:26

    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

    Information

    ID
    18040
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By