Pages

1/19/2014

UVA 10297 Beavergnaw Solution

import java.math.BigInteger;
import java.util.Scanner;
class Main {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
StringBuffer br = new StringBuffer("");

while(true) {
double D = sc.nextDouble();
double Vch = sc.nextDouble();
if (D==0.0 && Vch==0.0) break;

double res = (6.0/Math.PI) * (((Math.PI * D*D*D / 4.0) - Vch)) - (0.5 *D*D*D);
//System.out.println(res);
res = Math.pow(res,( 1.0/3.0));
//res = Math.round(res*1000)/1000.0;
System.out.printf("%.3f\n",res);

}
}

}

No comments :

Post a Comment