码迷,mamicode.com
首页 > 其他好文 > 详细

PAT1023. Have Fun with Numbers

时间:2015-02-21 16:33:11      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:

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.

Input Specification:

Each input file contains one test case.  Each case contains one positive integer with no more than 20 digits.

Output Specification:

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.

Sample Input:

1234567899

Sample Output:

Yes
2469135798

提交代码

      

PAT1023. Have Fun with Numbers

标签:

原文地址:http://www.cnblogs.com/GoFly/p/4297045.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!