Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

WHY WA?

Posted by shouhm at 2005-07-06 14:16:12 on Problem 2460
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator