|
|
back to boardWA # 9! Please give me some tests!!! Re: WA # 9! Please give me some tests!!! This is my code... import java.util.Scanner; public class T_1562 { public static double a,b; public static void main(String[] args) { Scanner sc= new Scanner(System.in); a = sc.nextDouble(); b = sc.nextDouble(); b = b/2; a = a/2; int n = sc.nextInt(); double step = 2*b/n; double x = -b; while(x+step <= b){ System.out.printf("%.6f",Math.abs(F(x)-F(x+step))); System.out.println(); x = x+step; } } private static double F(double z){ return Math.PI*(a/b)*(a/b)*(b*b*z - z*z*z/3); } } Edited by author 12.09.2011 14:14 Re: WA # 9! Please give me some tests!!! =) I have got AC!!! |
|
|