#P1206. [USACO1.2] 回文平方数 Palindromic Squares
[USACO1.2] 回文平方数 Palindromic Squares
Description
A palindromic number is a number that reads the same from left to right and from right to left. For example, is a typical palindrome.
Given a positive integer written in decimal, output all integers in whose squares, when written in base , are palindromes.
Input Format
One line containing a single positive integer .
Output Format
Each line contains two base- numbers: the first number and its square. The second number must be a palindrome.
Note that digits greater than are represented by letters. For example, use A for , B for , and use the -th uppercase letter to represent .
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
Hint
Constraints
For of the testdata, .
Translation from NOCOW.
USACO Training Section 1.2.
Translated by ChatGPT 5
京公网安备 11011102002149号