Pages

1/19/2014

UVA 10678 The Grazing Cow 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("");

int tc = sc.nextInt();

for (int i = 1; i<= tc;i++) {
double d= sc.nextDouble();
double l = sc.nextDouble();
double a = Math.sqrt(.25 * (l*l - d*d));
double b = l/2.0;

double area = Math.PI*a*b*1000;
System.out.printf("%.3f\n",Math.round(area)/1000.0);
}
}

}

No comments :

Post a Comment