Source code for submission s627

Fl.java

  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4.  
  5.  
  6. public class Fl {
  7.  
  8. public static void main(String[] args) throws IOException {
  9.  
  10.  
  11. String line;
  12. int n;
  13. int pocet;
  14. int i;
  15. while((line = br.readLine()) != null){
  16. pocet = 0;
  17. n = Integer.parseInt(line.substring(2));
  18. i = n+1;
  19.  
  20. while (i <= 2*n) {
  21. if(jeCele(i, n)){
  22. pocet++;
  23. }
  24. i++;
  25. }
  26. System.out.println(pocet);
  27. }
  28.  
  29. br.close();
  30. }
  31.  
  32.  
  33. public static boolean jeCele(int i, int n){
  34. double x1 = (n*i) / (double) (i-n);
  35. double x2 = Math.floor(x1);
  36. double eps = 0.0000001;
  37. if (x1-x2 <= eps){
  38. return true;
  39. }
  40. return false;
  41. }
  42. }
  43.