Go to diff to previous submission
import java.util.HashSet; import java.util.Scanner; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author kajanek6 */ public class Fl { HashSet<Integer> mnozina=new HashSet<Integer>(); int n=0; int counter=0; int y=0; while (input.hasNextLine()) { mnozina.clear(); counter=0; if(temp.length()>1) for(int i=1;i<=20000;i++) { if((i-n)>0){ int vysl = (n*i)/(i-n); int zvysok=(n*i)%(i-n); if(vysl>0 && zvysok==0) { if(!mnozina.contains(i)){ counter++; mnozina.add(i); mnozina.add(vysl); } } } } }} } public class pair{ public int prvy; public int druhy; public pair(int a,int b){ prvy=a; druhy=b; } } }
--- c5.s771.cteam087.fl.java.0.Fl.java +++ c5.s782.cteam087.fl.java.0.Fl.java @@ -25,9 +25,7 @@ counter=0; String temp = input.nextLine(); - if(temp.length()==0){ - continue; - } - n=Integer.parseInt(temp.substring(2)); - for(int i=1;i<=100000;i++) + if(temp.length()>1) + { n=Integer.parseInt(temp.substring(2)); + for(int i=1;i<=20000;i++) { if((i-n)>0){ @@ -47,5 +45,5 @@ } System.out.printf("%d\n",counter); - } + }} }