2013
11-10

# The Circumference of the Circle

To calculate the circumference of a circle seems to be an easy task – provided you know its diameter. But what if you don’t?

You are given the cartesian coordinates of three non-collinear points in the plane.

Your job is to calculate the circumference of the unique circle that intersects all three points.

The input will contain one or more test cases. Each test case consists of one line containing six real numbers x1,y1, x2,y2,x3,y3, representing the coordinates of the three points. The diameter of the circle determined by the three points will never exceed a million. Input is terminated by end of file.

For each test case, print one line containing one real number telling the circumference of the circle determined by the three points. The circumference is to be printed accurately rounded to two decimals. The value of pi is approximately 3.141592653589793.

0.0 -0.5 0.5 0.0 0.0 0.5
0.0 0.0 0.0 1.0 1.0 1.0
5.0 5.0 5.0 7.0 4.0 6.0
0.0 0.0 -1.0 7.0 7.0 7.0
50.0 50.0 50.0 70.0 40.0 60.0
0.0 0.0 10.0 0.0 20.0 1.0
0.0 -500000.0 500000.0 0.0 0.0 500000.0


3.14
4.44
6.28
31.42
62.83
632.24
3141592.65


//* @author popop0p0popo
import java.util.*;
import java.io.*;

public class Main{
public static void main(String[] args){
double[] x,y;
double k1,k2,b1,b2,ox,oy;
double r;
while (scanner.hasNext()){
x=new double[3];
y=new double[3];
for (int i=0;i< 3 ;i++ ){
x[i]=scanner.nextDouble();
y[i]=scanner.nextDouble();
}
if (y[0]==y[1]){
double t=y[0];
y[0]=y[2];
y[2]=t;
t=x[0];
x[0]=x[2];
x[2]=t;
}
if (y[0]==y[2]){
double t=y[0];
y[0]=y[1];
y[1]=t;
t=x[0];
x[0]=x[1];
x[1]=t;
}
k1=0-(x[0]-x[1])/(y[0]-y[1]);
b1=(y[0]+y[1])/2-k1*(x[0]+x[1])/2;
k2=0-(x[0]-x[2])/(y[0]-y[2]);
b2=(y[0]+y[2])/2-k2*(x[0]+x[2])/2;
ox=(b2-b1)/(k1-k2);
oy=k1*ox+b1;
r=Math.sqrt((ox-x[0])*(ox-x[0])+(oy-y[0])*(oy-y[0]));
System.out.println(Math.round(2*3.141592653589793*r*100.0)/100.0);
}
}
}

1. 博主您好，这是一个内容十分优秀的博客，而且界面也非常漂亮。但是为什么博客的响应速度这么慢，虽然博客的主机在国外，但是我开启VPN还是经常响应很久，再者打开某些页面经常会出现数据库连接出错的提示

2. 可以参考算法导论中的时间戳。就是结束访问时间，最后结束的顶点肯定是入度为0的顶点，因为DFS要回溯

3. 第一句可以忽略不计了吧。从第二句开始分析，说明这个花色下的所有牌都会在其它里面出现，那么还剩下♠️和♦️。第三句，可以排除2和7，因为在两种花色里有。现在是第四句，因为♠️还剩下多个，只有是♦️B才能知道答案。

4. 在方法1里面：

//遍历所有的边，计算入度
for(int i=0; i<V; i++)
{
degree = 0;