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

Re:这道题,偶用解析几何过的,求两条直线垂直平分线的交点,即为圆心,然后求半径.看了大家的帖子,学习!!!!!!

Posted by lyyshp at 2017-05-12 10:58:37 on Problem 2242
In Reply To:这道题,偶用解析几何过的,求两条直线垂直平分线的交点,即为圆心,然后求半径.看了大家的帖子,学习!!!!!! Posted by:Ontheline at 2009-02-18 12:18:43
#include <cstdio>
#include <cmath>

int main() 
{
    double x1, y1, x2, y2, x3, y3, X1, Y1, X2, Y2, x, y, k1, k2, r, t;
        
    while(~scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3)){
    	if(y1 == y2) t = x1, x1 = x3, x3 = t, t = y1, y1 = y3, y3 = t;
    	else if(y1 == y3) t = x1, x1 = x2, x2 = t, t = y1, y1 = y2, y2 = t;
        X1 = (x1 + x2) / 2, Y1 = (y1 + y2) / 2, k1 = (x1 - x2) / (y2 - y1);
        X2 = (x1 + x3) / 2, Y2 = (y1 + y3) / 2, k2 = (x1 - x3) / (y3 - y1);
        x = (Y2 - Y1 + k1 * X1 - k2 * X2) / (k1 - k2);
        y = k1 * (x - X1) + Y1;
        r = sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
        printf("%.2f\n", 2 * 3.141592653589793 * r);
    }
                
    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