#include #include using namespace std; #define FORN(i,a,b) for (int i=a;i<=b;i++) const int MAX=1000000; pair getPair(double n) { int a,b; int c=0; double mingap=0.999; //just under 1 FORN(i,1,MAX) { int jlow=(int)(i/(n+mingap)); int jhigh=(int) (i/(n-mingap)); jlow=jlow<1?1:jlow; jhigh=jhigh>MAX?MAX:jhigh; FORN(j,jlow,jhigh) { double temp=abs((double)i/j-n); if (temp>n && n!=0) { pair p=getPair(n); if (casenum>1) cout<