Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<string>
- #include<cmath>
- #include<iostream>
- #include<algorithm>
- #include<iomanip>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- long double mas_x[100000];
- long double mas_y[100000];
- for (int i = 1; i <= n; i++)
- {
- cin >> mas_x[i] >> mas_y[i];
- }
- long double res = 0;
- mas_x[n+1] = mas_x[1];
- mas_y[n+1] = mas_y[1];
- for (int i = 1; i <= n; i++)
- {
- res += ((mas_y[i + 1] + mas_y[i])*(mas_x[i + 1] - mas_x[i]));
- }
- cout<<(abs(res) / 2.0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement