Go to diff to previous submission
#include <cstdio> #include <cmath> #include <cstdlib> using namespace std; int isInt( double y ) { return abs(y - round(y)) <= 0.0000001; } int main() { int n; while( scanf("1/%d", &n) ) { double y; int x = 2*n; int count = 0; for( x = n+1; x <= 2*n; x++ ) { y = (double)(n*x) / (double)(x-n); if( isInt(y) ) count ++; } printf( "%d\n", count ); } return 0; }
--- c5.s579.cteam031.fl.cpp.0.fl.cpp +++ c5.s583.cteam031.fl.cpp.0.fl.cpp @@ -6,5 +6,5 @@ int isInt( double y ) { - return abs(y - round(y)) <= 0.00001; + return abs(y - round(y)) <= 0.0000001; }