Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
!!!!!!!!!!!!!!!!!!!!!!!#include <iostream> #include <stdio.h> #include <stdlib.h> #include <math.h> #include <algorithm> #include <string> #include <cstring> #include <vector> #include <queue> #include <stack> #include <map> using namespace std; struct node { double x,y; bool operator<(node a)const { if(x==a.x) return y<a.y; return x<a.x; } }p[5]; int main() { while(scanf("%lf %lf %lf %lf %lf %lf %lf%lf",&p[0].x,&p[0].y,&p[1].x,&p[1].y,&p[2].x,&p[2].y,&p[3].x,&p[3].y)!=EOF) { sort(p,p+4); double mx=0,my=0; for(int i=0;i<4;i++) { mx+=p[i].x; my+=p[i].y; if(i&&p[i].x==p[i-1].x&&p[i].y==p[i-1].y) { mx-=3*p[i].x; my-=3*p[i].y; } } printf("%.3f %.3f\n",mx,my); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator