Quipex icon

Untitled

Quipex | PRO | 03/13/17 02:44:35 PM UTC | 0 ⭐ | 424 👁️ | Never ⏰ | []
text |

1.96 KB

|

None

|

0 👍

/

0 👎

//880
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <cstring>
#include <string>
#include <iterator>
#include <iomanip>
using namespace std;
 #define sqr(x) ((x)*(x))
#define cbr(x) ((x)*(x)*(x))
#define rep(c, i, n) for((i)=(c); (i)<(n); (i)++)
struct pt{long long x,y;};
double vecmul(pt a, pt b){ /*Векторное умножение А*В*/ return (a.x*b.y - b.x*a.y); } //скалярное умножение a*b = |a|*|b|*cos(a,b)
 double dist(double ax, double ay, double bx, double by) { return sqrt(sqr(ax - bx) + sqr(ay - by)); }
 //DBG
template<typename T, typename T2>void printarr(T  a[], T2 sz, T2 beg = 0) { for (T2 i = beg; i<sz; i++) cout << a[i] << " "; cout << endl; }
#define DBG(a)         cout<<#a<<"="<<(a)<<"\n"
#define DBG2(a,b)       cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBG3(a,b,c)     cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
 //Files
#define FILE_MODE(FILE) freopen(FILE".in", "r", stdin), freopen(FILE".out", "w", stdout)
 //Constants
#define PI    3.1415926535897932
#define INF   1011111111
#define LLINF 1000111000111000111LL
#define eps   1e-14
#define mod   1000000007
//-------------------------------------------------
#define N 21
 double area(pt a, pt b){
    return (a.y+b.y)*(a.x-b.x);
}
pt center(pt a, pt b, pt c){
    pt cen;
    cen.x =(a.x+b.x+c.x);
    cen.y =(a.y+b.y+c.y);
    return cen;
}
pt line(pt a, pt b){
    pt line;
    line.x=b.x-a.x;
    line.y=b.y-a.y;
    return line;
}
 int main(){
    int n;
    cin >> n;
    vector<pt> points;
    points.reserve(50000);
    int i;
    double sumX=0, sumY=0;
    for(i=0;i<n; i+=3){
        cin >> points[i].x >> points[i].y;
        cin >> points[i+1].x >> points[i+1].y;
        cin >> points[i+2].x >> points[i+2].y;
        sumX+=center(points[i],points[i+1],points[i+2]);
     }
    cout<< fixed <<setprecision(2)<< TODO;
    return 0;
}

Comments