daily pastebin goal
45%
SHARE
TWEET

Untitled

Lucafont Jan 20th, 2019 14 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main(){
  6.     long int num;
  7.     cin >> num;
  8.     long long int point[num][2];
  9.     for (int i = 0; i < num; i++){
  10.         cin>>point[i][0]>>point[i][1];
  11.     }
  12.     long long int a=0;
  13.     for (int i = 0; i < num-1; i++){
  14.         a+=point[i][0]*point[i+1][1]-point[i+1][0]*point[i][1];
  15.     }
  16.     a+=point[num-1][0]*point[0][1]-point[0][0]*point[num-1][1];
  17.     long long int res = abs(a)*0.5;
  18.     cout << res;
  19.  
  20.     return 0;
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top