|
|
вернуться в форумJAVA - What's wrong with my solution (Crashed) Послано JOLO_ 16 авг 2012 01:38 public class Buttons { public static void main(String[] args) { //convert parameter into int int N = 0; try { N = Integer.parseInt(args[0]); } catch(NumberFormatException ignore) {} //find L for(int i = 3; i < Math.sqrt(N); i++) { if(N%i == 0) { System.out.println(i-1); System.exit(1); } } System.out.println(N-1); } } P.S. On my computer it works perfectly Re: JAVA - What's wrong with my solution (Crashed) Послано Noob 16 авг 2012 02:27 Numbers are read from stdin |
|
|