Source code for submission s732

Go to diff to previous submission

Fl.java

  1.  
  2. import java.util.HashSet;
  3. import java.util.Scanner;
  4.  
  5. /*
  6.  * To change this template, choose Tools | Templates
  7.  * and open the template in the editor.
  8.  */
  9.  
  10. /**
  11.  *
  12.  * @author kajanek6
  13.  */
  14. public class Fl {
  15.  
  16.  
  17. public static void main(String[] args) {
  18. HashSet<Integer> mnozina=new HashSet<Integer>();
  19. int n=0;
  20. int counter=0;
  21. int y=0;
  22. Scanner input = new Scanner(System.in);
  23. while (input.hasNextLine()) {
  24. counter=0;
  25. String temp = input.nextLine();
  26. if(temp.length()<2){break;}
  27. n=Integer.parseInt(temp.substring(2));
  28. for(int i=1;i<=10000;i++)
  29. {
  30. if((i-n)>0){
  31. int vysl = (n*i)/(i-n);
  32. int zvysok=(n*i)%(i-n);
  33. if(vysl>0 && zvysok==0)
  34. {
  35. if(!mnozina.contains(i)){
  36. counter++;
  37. mnozina.add(i);
  38. mnozina.add(vysl);
  39. }
  40.  
  41.  
  42. }
  43. }
  44. }
  45. System.out.printf("%d\n",counter);
  46. }
  47. }
  48.  
  49. public class pair{
  50. public int prvy;
  51. public int druhy;
  52.  
  53. public pair(int a,int b){
  54. prvy=a;
  55. druhy=b;
  56. }
  57. }
  58. }
  59.  

Diff to submission s715

Fl.java

--- c5.s715.cteam087.fl.java.0.Fl.java
+++ c5.s732.cteam087.fl.java.0.Fl.java
@@ -24,4 +24,5 @@
             counter=0;
             String temp = input.nextLine();
+            if(temp.length()<2){break;}
             n=Integer.parseInt(temp.substring(2));
             for(int i=1;i<=10000;i++)