A.Santa Claus and a Place in a Class
Petya studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the last class the teacher wrote three positive integers a, b, c on the blackboard. The task was to insert signs of operations '+' and '*', and probably brackets between the numbers so that the value of the resulting expression is as large as possible. Let's consider an example: assume that the teacher wrote numbers 1, 2 and 3 on the blackboard. Here are some ways of placing signs and brackets:
Note that you can insert operation signs only between a and b, and between b and c, that is, you cannot swap integers. For instance, in the given sample you cannot get expression (1+3)*2.
It's easy to see that the maximum value that you can obtain is 9.
Your task is: given a, b and c print the maximum value that you can get. 继续阅读
A number is "prime" if it has no divisors other than itself and 1. For example, 23 is prime but 35 is not prime because 35 = 7 x 5. If the digits of a number are rearranged, then usually its primeness changes — for example, 35 is not prime but 53 is. For this problem, you must find numbers which are prime no matter how you rearrange their digits. For example, all of the numbers 113, 131 and 311 are prime, so we say that 113 is an "anagrammatic prime" (also 131 and 311 are anagrammatic primes).
C题是因为我没能考虑到特殊情况而苦于wa on 14,7 times