Advertisement
Guest User

Untitled

a guest
Aug 30th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include<string>
  2. #include<cmath>
  3. #include<iostream>
  4. #include<algorithm>
  5. #include<iomanip>
  6. using namespace std;
  7. int main()
  8. {
  9. int n;
  10. cin >> n;
  11. long double mas_x[100000];
  12. long double mas_y[100000];
  13. for (int i = 1; i <= n; i++)
  14. {
  15. cin >> mas_x[i] >> mas_y[i];
  16. }
  17. long double res = 0;
  18. mas_x[n+1] = mas_x[1];
  19. mas_y[n+1] = mas_y[1];
  20. for (int i = 1; i <= n; i++)
  21. {
  22. res += ((mas_y[i + 1] + mas_y[i])*(mas_x[i + 1] - mas_x[i]));
  23. }
  24. cout<<(abs(res) / 2.0);
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement