10108_PalindromicSquares

2022-5-16 18:16| 发布者: Hocassian| 查看: 74| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-3-89504559701400-Problem List-采集的数据-后羿采集器.html

Pro.ID

10108

Title

Palindromic Squares

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=10108

AC

102

Submit

279

Ratio

36.56%

时间&空间限制

  • Time Limit: 200/100 MS (Java/Others)     Memory Limit: 32768/32768 K (Java/Others)
  • 描述

    Palindromes are numbers that read the same forwards as backwards. The number 12321 is a typical palindrome.

    Given a number base B ( 2 ≤ B ≤ 20 base 10 ), print all the integers N ( 1 ≤ N ≤ 300 base 10 ) such that the square of N is palindromic when expressed in base B; also print the value of that palindromic square. Use the letters 'A', 'B', and so on to represent the digits 10, 11, and so on.

    Print both the number and its square in base B.

    输入

    Multiple test cases, one per line. Each line is an integer B, the base (specified in base 10).

    输出

    Description

    Palindromes are numbers that read the same forwards as backwards. The number 12321 is a typical palindrome.

    Given a number base B ( 2 ≤ B ≤ 20 base 10 ), print all the integers N ( 1 ≤ N ≤ 300 base 10 ) such that the square of N is palindromic when expressed in base B; also print the value of that palindromic square. Use the letters 'A', 'B', and so on to represent the digits 10, 11, and so on.

    Print both the number and its square in base B.

    Input

    Multiple test cases, one per line. Each line is an integer B, the base (specified in base 10).

    Output

    For each test case, output lines with two integers represented in base B. The first integer is the number whose square is palindromic; the second integer is the square itself.

    Sample Input

    10

    Sample Output

    1 1
    2 4
    3 9
    11 121
    22 484
    26 676
    101 10201
    111 12321
    121 14641
    202 40804
    212 44944
    264 69696

    Source

    样例输入

    10

    样例输出

    1 1
    2 4
    3 9
    11 121
    22 484
    26 676
    101 10201
    111 12321
    121 14641
    202 40804
    212 44944
    264 69696

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部