Source code for submission s647

fl.cpp

  1. #include <cstdio>
  2. #include <cmath>
  3. #include <iostream>
  4. #include <string>
  5. #include <cstdlib>
  6.  
  7. using namespace std;
  8.  
  9. #define EPS 0.000001
  10.  
  11. int main()
  12. {
  13. int c;
  14. while (scanf("%*d/%d", &c))
  15. {
  16. int times = 0;
  17. double n = c;
  18. for ( double x = n; x <= 2*n; x++ )
  19. if ( abs ( x*n/(x-n) - int( x*n/(x-n) ) ) < EPS )
  20. times++;
  21. printf( "%d\n", times );
  22. }
  23. return 0;
  24. }
  25.