|
|
back to boardcw or ccw => Wrong Answer 1 ??? 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; } |
|
|