Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <utility>
- #include <cmath>
- using namespace std;
- long double cross(pair<long double, long double> a, pair<long double, long double> b){return a.first*b.second-a.second*b.first;}
- long double dot(pair<long double, long double> a, pair<long double, long double> b){return a.first*b.first+a.second*b.second;}
- int main(){
- ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
- pair<long double, long double> bef={0, 1}, nw;
- long long i, n, angle, ans=0; cin >> n;
- long double sum=0;
- for(i=0; i<n; ++i){
- cin >> nw.first >> nw.second;
- sum+=atan2(cross(nw, bef), dot(nw, bef));
- swap(nw, bef);
- }
- sum*=360.0;
- sum/=6.2831853072;
- angle=round(sum);
- if(angle>0){
- ans=angle/360;
- angle%=360;
- } else{
- ans-=abs(angle)/360;
- }
- cout << ans;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement