Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
直接比大小就可以了,不需要做乘法!!!In Reply To:WHY WA? Posted by:shouhm at 2005-07-06 14:16:12 > #include <iostream.h> > using namespace std; > > const long limitn = 200001; > > long n, S1, S2, mid; > long xs[limitn], ys[limitn], _x, _y; > > int main() { > long i, x, y; > > cin >> n; > while (n != 0) { > S1 = 0; S2 = 0; > for (i = 1; i <= n; i ++) > cin >> xs[i] >> ys[i]; > mid = (n + 1) / 2; > for (i = 1; i <= n; i ++) { > if (xs[i] - xs[mid] == 0) continue; > if (ys[i] - ys[mid] == 0) continue; > _x = xs[i] - xs[mid]; > _y = ys[i] - ys[mid]; > if (_x * _y > 0) > S1 ++; > else > S2 ++; > } > cout << S1 << " " << S2 << endl; > cin >> n; > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator