// @BEGIN_OF_SOURCE_CODE /* @JUDGE_ID: 17243NT 149 C++ "Trig" */ // Send to judge@uva.es #include #include #include #ifdef ONLINE_JUDGE #define ins cin #define outs cout #else #define ins fin #define outs fout ifstream fin("myprog.in"); ofstream fout("myprog.out"); #endif void calculate(double h, double k); const double SIN005 = 0.00087266451523514954330458929907378; const double PI = 3.1415926535897932384626433832795; typedef struct { double a1, a2; } tree; tree tarray[1000000]; int ntree; int nsol; double radius; double maxdist, distsquare; tree newtree(double h, double k) { tree t; double angle = atan(h / k) / PI * 180; double mangle = atan(radius / sqrt(h * h + k * k - radius * radius)) / PI * 180; t.a1 = angle - mangle; t.a2 = angle + mangle; return t; } bool isbetween(tree t1, tree t2) { if(t1.a1 - 0.01 <= t2.a1 && t2.a1 <= t1.a2 + 0.01) return true; if(t1.a1 - 0.01 <= t2.a2 && t2.a2 <= t1.a2 + 0.01) return true; return false; } void quadrant(double ox, double oy) { double x, y; double t; int i, c = 0; if(ox * ox + oy * oy > distsquare) return; y = oy; t = sqrt(distsquare - y * y); for(x = ox; x <= t; x++) { tree t = newtree(x, y); for(i = 0; i < ntree; i++) if(isbetween(tarray[i], t)) { break; } if(i >= ntree) { nsol++; c++; } tarray[ntree++] = t; } x = ox; t = sqrt(distsquare - x * x); for(y = oy + 1; y <= t; y++) { tree t = newtree(x, y); for(i = 0; i < ntree; i++) if(isbetween(tarray[i], t)) { break; } if(i >= ntree) { nsol++; c++; } tarray[ntree++] = t; } quadrant(ox + 1, oy + 1); } int main() { double diam; double ox, oy; while(ins >> diam >> ox >> oy) { if(diam == 0) break; radius = diam / 2; maxdist = radius / SIN005; distsquare = maxdist * maxdist; nsol = 0; ntree = 0; quadrant(1 - ox, 1 - oy); ntree = 0; quadrant(1 - ox, oy); ntree = 0; quadrant(ox, 1 - oy); ntree = 0; quadrant(ox, oy); cout << nsol << endl; } return 0; } // @END_OF_SOURCE_CODE