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

## 你这题它md扯蛋啊！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！1

Posted by kknd123 at 2005-02-06 18:38:19 on Problem 1927
```怎么数据类型用double就是对的，用float就是错的？

import java.io.*;
import java.util.StringTokenizer;
import java.math.*;

public class 围成面积{
public final double PI = (double) Math.PI;
public 围成面积() {
}

public void Start() throws Exception {
int q = 0;
while (!teststring.equals("0 0 0 0")) {
q++;
StringTokenizer st = new StringTokenizer(teststring);
String[] s1 = new String[4];
int i = 0;
while (st.hasMoreTokens()) {
s1[i] = st.nextToken();
i++;
}
double[] f = new double[4];
for (int j = 0; j < 4; j++) {
Double y1 = new Double(s1[j]);
f[j] = y1.doubleValue();
}
double ra = 0f; //所得圆的半径
double s = 0f; //绳子为成总面积
double c = f[1] + f[2] + f[0]; //三角形边场
double cosa = (f[1] * f[1] + f[2] * f[2] - f[0] * f[0]) / (2 * (f[1] * f[2]));
double cosb = (f[0] * f[0] + f[2] * f[2] - f[1] * f[1]) / (2 * (f[0] * f[2]));
double cosc = (f[1] * f[1] + f[0] * f[0] - f[2] * f[2]) / (2 * (f[1] * f[0]));
double St = 0f; //三角形面积
St = 0.5f * f[1] * f[2] * (double) Math.sin(Math.acos(cosa));
double ri = 2 * St / (f[0] + f[1] + f[2]); // 内结缘半径
double ci = 2 * PI * ri;
if (f[3] <= ci) {
ra = f[3] / (2 * PI);
s = PI * ra * ra;
}
else {
ra = 0.5f * (f[3] - c) /
(double) (PI - 1 / Math.tan(0.5 * Math.acos(cosa)) -
1 / Math.tan(0.5 * Math.acos(cosb)) -
1 / Math.tan(0.5 * Math.acos(cosc)));
s = PI * ra * ra + St -
ra *
ra*(double)(1 / Math.tan(0.5 * Math.acos(cosa)) +
1 / Math.tan(0.5 * Math.acos(cosb)) +
1 / Math.tan(0.5 * Math.acos(cosc)));
}

double temp0 = Math.round(100 * s);
s = temp0 / 100;
String ts = "" + s;
int len = ts.length() - 1 - ts.indexOf(".");
ts = "";
for (int a = 2 - len; a > 0; a--) {
ts = ts + "0";
}
System.out.println("Case " + q + ": " + s + ts);
}
}

public static void main(String[] args) throws Exception {
围成面积 t1 = new 围成面积();
t1.Start();
}

}
```

Followed by: