题目地址:http://poj.org/problem?id=2325
import java.util.*;
import java.math.*;
import java.text.*;
import java.io.*;public class Main
{public static void main(String[] args) {Scanner cin = new Scanner(new BufferedInputStream(System.in));while(cin.hasNext()){BigInteger x=cin.nextBigInteger();if(x.equals(BigInteger.valueOf(-1))) break;String ans=new String();if(x.equals(BigInteger.ZERO)) ans="10";if(x.equals(BigInteger.ONE)) ans="11";boolean done=true;while(x.compareTo(BigInteger.ONE)>0){boolean ok=false;for(int i=9;i>=2;i--) if((x.mod(BigInteger.valueOf(i))).equals(BigInteger.ZERO)) {ans=i+ans;x=x.divide(BigInteger.valueOf(i));ok=true;break;}if(ok==false) {done=false;break;}}if(!done) System.out.println("There is no such number.");else {if(ans.length()==1) ans='1'+ans;System.out.println(ans);}}}
}