#P7174. [COCI 2014/2015 #4] CESTA
[COCI 2014/2015 #4] CESTA
Description
Mirko found a positive integer . Since Mirko likes the number , he wants to know the largest multiple of among the numbers that can be formed using each digit of .
Write a program to compute this number (if it does not exist, output -1).
Input Format
One number .
Output Format
Only one line: the required number.
30
30
102
210
2931
-1
Hint
Constraints
For of the testdata, the number of digits of does not exceed .
Notes
This problem is translated from COCI2014-2015 CONTEST #4 T1 CESTA.
Translated by ChatGPT 5
京公网安备 11011102002149号