import java.io.*;
public class Main {
/**
* http://acm.tju.edu.cn/toj/showp1131.html
* @author hunglee
* @throws IOException
*/
public static void main(String[] args) throws IOException {
StreamTokenizer in = new StreamTokenizer(new BufferedReader(
new InputStreamReader(System.in)));
final double PI = 3.141592653589793;
double x1, x2, x3, y1, y2, y3;
double x, y, dx, dy, d, a1, b1, c1, a2, b2, c2, r, c;
while (in.nextToken() != StreamTokenizer.TT_EOF) {
x1 = in.nval;
in.nextToken(); y1 = in.nval;
in.nextToken(); x2 = in.nval;
in.nextToken(); y2 = in.nval;
in.nextToken(); x3 = in.nval;
in.nextToken(); y3 = in.nval;
a1 = 2.0 * (x2 - x1);
b1 = 2.0 * (y2 - y1);
c1 = x2 * x2 + y2 * y2 - x1 * x1 - y1 * y1;
a2 = 2.0 * (x3 - x1);
b2 = 2.0 * (y3 - y1);
c2 = x3 * x3 + y3 * y3 - x1 * x1 - y1 * y1;
dx = c1 * b2 - c2 * b1;
dy = a1 * c2 - a2 * c1;
d = a1 * b2 - a2 * b1;
x = dx / d;
y = dy / d;
r = Math.sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
c = 2.0 * r * PI;
System.out.println(String.format("%.2f", c));
}
}
}
Thứ Bảy, 1 tháng 1, 2011
1131. The Circumference Of The Circle
Đăng ký:
Đăng Nhận xét (Atom)
Không có nhận xét nào:
Đăng nhận xét