Source code for submission s949

Fl.java

  1.  
  2. import java.util.Scanner;
  3.  
  4. /*
  5.  * To change this template, choose Tools | Templates
  6.  * and open the template in the editor.
  7.  */
  8.  
  9. /**
  10.  *
  11.  * @author cteam038
  12.  */
  13. public class Fl {
  14.  
  15. public static void main(String [] args) {
  16. Scanner scanner = new Scanner(System.in);
  17. while (scanner.hasNext()) {
  18. int n = Integer.parseInt(scanner.nextLine().substring(2));
  19. int r = 0;
  20.  
  21. if (n == 1) {
  22. r = 1;
  23. System.out.println(r);
  24. continue;
  25. }
  26.  
  27. int i = n + 1;
  28.  
  29. while(true) {
  30.  
  31. if (((n*i) % (i-n)) == 0) {
  32. r++;
  33. }
  34.  
  35. i++;
  36.  
  37. if ((i*i) > n*(2*i)) {
  38. break;
  39. }
  40. // if (i*(i+1) > n*(2*i+1)) {
  41. // break;
  42. // }
  43. }
  44.  
  45. /*
  46.   for (int i = 1; i <= n; i++) {
  47.   //System.out.println(i);
  48.   //System.out.println("ahoj" + (n*(i+1))%i);
  49.   if ((n * (i+1)) % i == 0) r++;
  50.   }*/
  51.  
  52.  
  53. System.out.println(r);
  54. }
  55.  
  56. }
  57.  
  58. }
  59.