JOIN
Get Time

   Problem Statement  

 Problem Statement for Permutiple

Problem Statement

    You are given a positive integer x. Please check whether we can rearrange the digits of x (in base 10, without leading zeros) to produce a different number that is a multiple of x.



Return "Possible" if this can be done and "Impossible" otherwise. Note that the return value is case-sensitive.
 

Definition

    
Class:Permutiple
Method:isPossible
Parameters:int
Returns:String
Method signature:String isPossible(int x)
(be sure your method is public)
    
 

Constraints

-x will be between 1 and 1,000,000, inclusive.
 

Examples

0)
    
142857
Returns: "Possible"
One valid way of rearranging the digits of 142857 is to form the number 285714. This new number is a multiple of x: we have 285714 = 2 * 142857.



Another valid way is to form the number 857142 (which is equal to 6 * 142857).
1)
    
14
Returns: "Impossible"
The only other number we can get by rearranging the digits of the number 14 is the number 41. As 41 is not a multiple of 14, there is no solution.
2)
    
1035
Returns: "Possible"
We can get 3105 = 3 * 1035.
3)
    
1000000
Returns: "Impossible"
4)
    
100035
Returns: "Possible"
5)
    
4
Returns: "Impossible"

This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2010, TopCoder, Inc. All rights reserved.

This problem was used for:
       Single Round Match 716 Round 1 - Division II, Level One