题目:
Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactly the numbers from 1 to 9, only in a different permutation. Check to see the result if we double it again!
Now you are suppose to check if there are more numbers with this property. That is, double a given number with k digits, you are to tell if the resulting number consists of only a permutation of the digits in the original number.
输入格式:
Each input contains one test case. Each case contains one positive integer with no more than 20 digits.
输出格式:
For each test case, first print in a line “Yes” if doubling the input number gives a number that consists of only a permutation of the digits in the original number, or “No” if not. Then in the next line, print the doubled number.
输入样例:
1234567899
输出样例:
Yes
2469135798
【题目大意】:
数字123456789是一个9位数的数字,完全由1到9的数字组成,没有重复。把它翻倍,就得到246913578,它正好是另一个9位数的数字,恰好由1到9这两个数字组成,只是排列方式不同。再翻一倍看看结果!
要检查是否有更多的数字具有这个性质。也就是说,将一个给定的数字乘以两倍,得到的数字是否只包含原数字中数字的排列。
思路: