Pro.ID10108 TitlePalindromic Squares Title链接http://10.20.2.8/oj/exercise/problem?problem_id=10108 AC102 Submit279 Ratio36.56% 时间&空间限制描述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 Source 样例输入10 样例输出1 1 作者 |