|
|
back to boardCommon Board1014 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 please!!!!!!!!!!!!!!!!!!!!! Re: 1014 For n=0 answer is 10, not 0. |
|
|