Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

!!!!!!!!!!!!!!!!!!!!!!!

Posted by keys at 2012-08-18 20:48:09 on Problem 2624
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator