ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

1014
Posted by Fadeev.E.V 2 Jan 2011 01:32
Has written an aaplet, but writes that 4 errors, nevertheless are correct. Help please.
________________________________________________________________________________________________________________
import java.io.*;
class MyCl {
    public static String Min(int value) {
          if (value < 0)
            return "";

          if (value == 0)
            return "0";

          if (value == 1)
            return "1";

          StringBuilder Sb = new StringBuilder();

          for (int div = 9; div > 1; --div) {
            while (value % div == 0) {
              value = value / div;

              Sb.insert(0, div);
            }
          }
      if (value > 1)
            return "-1";
     return Sb.toString();
      }
}
 class MyClass {
    public static void main(String[] arqs)
    throws IOException {
          int n;
      String str;
      BufferedReader br  = new BufferedReader ( new InputStreamReader(System.in));
      str = br.readLine();
      n = Integer.parseInt(str);
      System.out.println(MyCl.Min(n));

    }
}
________________________________________________________________________________________________________________
Re: 1014
Posted by Fadeev.E.V 2 Jan 2011 20:11
please!!!!!!!!!!!!!!!!!!!!!
Re: 1014
Posted by Sergey Lazarev (MSU Tashkent) 2 Jan 2011 22:12
For n=0 answer is 10, not 0.
Re: 1014
Posted by Fadeev.E.V 2 Jan 2011 22:24
EEEE!Spasibo
Re: 1014
Posted by Fadeev.E.V 2 Jan 2011 22:24
Thank you,man.