ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1562. GM-pineapple

WA # 9! Please give me some tests!!!
Posted by Enigma [UB of TUIT] 12 Sep 2011 13:11
Re: WA # 9! Please give me some tests!!!
Posted by Enigma [UB of TUIT] 12 Sep 2011 14:13
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!!!
Posted by Enigma [UB of TUIT] 14 Sep 2011 17:06
=) I have got AC!!!