Source code for submission s758

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. mnozina.clear();
  25. counter=0;
  26. String temp = input.nextLine();
  27. if(temp.length()==0){
  28. continue;
  29. }
  30. n=Integer.parseInt(temp.substring(2));
  31. for(int i=1;i<=10000;i++)
  32. {
  33. if((i-n)>0){
  34. int vysl = (n*i)/(i-n);
  35. int zvysok=(n*i)%(i-n);
  36. if(vysl>0 && zvysok==0)
  37. {
  38. if(!mnozina.contains(i)){
  39. counter++;
  40. mnozina.add(i);
  41. mnozina.add(vysl);
  42. }
  43.  
  44.  
  45. }
  46. }
  47. }
  48. System.out.printf("%d\n",counter);
  49. }
  50. }
  51.  
  52. public class pair{
  53. public int prvy;
  54. public int druhy;
  55.  
  56. public pair(int a,int b){
  57. prvy=a;
  58. druhy=b;
  59. }
  60. }
  61. }
  62.  

Diff to submission s746

Fl.java

--- c5.s746.cteam087.fl.java.0.Fl.java
+++ c5.s758.cteam087.fl.java.0.Fl.java
@@ -22,4 +22,5 @@
         Scanner input = new Scanner(System.in);
         while (input.hasNextLine()) {
+            mnozina.clear();
             counter=0;
             String temp = input.nextLine();