acm题求高手解决

来源:互联网 发布:淘宝外网活动 编辑:程序博客网 时间:2024/05/18 14:44

Problem G: Divided by Eleven Color: Purple Given an integer, each digit of the number can be mixed up randomly. In these numbers, what is the largest number that can be divided by 11 exactly? For example, 121, no matter how you arrange them, only 121 can be divided by 11, so the result is 121. For 1210, 2101 can divide exactly by 11, so the result is 2101. Input Each line of input includes one positive integers x (0 < x < 10^100). The input is terminated if x equals zero. Output For each input, output the largest number that can be divided by 11 exactly. If this number is not existed, just print "No Way!" Sample Input 121 1210 35 0 Sample Output 121 2101 No Way!

原创粉丝点击