// Gokuri #include #include #include #include #include #include #include #include #include #include using namespace std; #define FNAME "inside.txt" #define fin cin typedef complex point; int IPIP( const point& p, const vector& vi ) { //cout << p << endl; vector v(vi); for(int i=0; i!=v.size(); ++i) v[i] -= p; int count = 0; for(int i=0; i!=v.size(); ++i) { point a = v[i]; point b = v[(i+1)%v.size()]; int fy = b.imag() - a.imag(); if( fy == 0 ) { if( a.imag() == 0 ) if( a.real() <=0 && 0<= b.real() || b.real() <=0 && 0<= a.real() ) return 1; } else { // x := fy*x in Out Library int x = a.real()*fy - a.imag()*(b.real()-a.real()); if( x == 0 ) { if( a.imag() <=0 && 0<= b.imag() || b.imag() <=0 && 0<= a.imag() ) return 1; return 0; } if( 0 < x*fy ) { bool judge1; if( fy > 0 ) judge1 = (-fy& poly, vector& pts ) { int cnt = 0; for(int i=0; i!=pts.size(); ++i) if( IPIP( pts[i], poly ) ) ++cnt; return cnt; } int main(void) { ifstream fin(FNAME); if (!fin) { return 1; } // INPUT HERE int n, m, nProb=0; while( cin>>n>>m, n||m ) { vector poly; while( n-- ) { int x, y; cin >> x >> y; poly.push_back( point(x,y) ); } vector pts; while( m-- ) { int x, y; cin >> x >> y; pts.push_back( point(x,y) ); } cout << "Data set " << ++nProb << ": " << solve(poly,pts) << endl; } return 0; }