ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1246. Tethered Dog

cw or ccw => Wrong Answer 1 ???
Posted by Desperados[KhAI] >> Starov_Lesha 9 Jun 2008 22:17
Why WA1 ???
Even if replace cw and ccw. The same with lowermost (3) point.
Help me pleace. What with my output?

#include <iostream>
using namespace std;

int main()
{
    int n;
    int x1, y1;
    int x, y;
    int Oldx, Oldy;

    cin >> n;

    cin >> x1 >> y1;

    Oldx=x1;
    Oldy=y1;

    double sum = 0;

    for(int i=2; i<=n; ++i)
    {
        scanf("%d %d", &x, &y);
        sum += (Oldx*(double)y-x*(double)Oldy);
        Oldx=x;
        Oldy=y;
    }

    sum += (x*(double)y1-x1*(double)y);

    if(sum)
        cout << "cw";
    else
        cout << "ccw";


    return 0;
}