Source code for submission s764

Program.java

  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package zlomky;
  6.  
  7. import java.util.ArrayList;
  8. import java.util.Scanner;
  9.  
  10. /**
  11.  *
  12.  * @author kormanec4
  13.  */
  14. class Program {
  15.  
  16. private Scanner sc;
  17. private ArrayList<Integer> vysledky= new ArrayList();
  18. public Program() {
  19. sc = new Scanner(System.in);
  20. while (sc.hasNext()) {
  21. int cislo = Integer.parseInt(sc.nextLine().substring(2));
  22. int pocRieseni=0;
  23.  
  24. for(int x=cislo+1;x<=2*cislo;x++){
  25. double y = (cislo*x)/(x-cislo);
  26. if(cislo==(x*y)/(x+y))pocRieseni++;
  27. }
  28. vysledky.add(pocRieseni);
  29. }
  30. for (Integer integer : vysledky) {
  31. System.out.println(integer);
  32. }
  33. }
  34. }
  35.  

Zlomky.java

download edit
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package zlomky;
  6.  
  7. /**
  8.  *
  9.  * @author kormanec4
  10.  */
  11. public class Zlomky {
  12.  
  13. /**
  14.   * @param args the command line arguments
  15.   */
  16. public static void main(String[] args) {
  17. new Program();
  18. }
  19. }
  20.