Pages

1/19/2014

UVA 10432 Solution

import java.util.Arrays;
import java.util.Scanner;


class Main {

/**UVA java solution to  10432
* @param args
*/
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
double  PI = 4*Math.atan(1.0);
//System.out.println(PI);
while(sc.hasNext()) {
double r = sc.nextDouble();
double n = sc.nextDouble();
//System.out.println(Math.sin( 2* Math.PI / n));
double area = 0.5 *n* r*r * Math.sin(  2* PI  / n);
System.out.printf("%.3f\n", (double)Math.round(area*1000)/1000);
}
System.exit(0);

}
}

No comments :

Post a Comment