Subscribed unsubscribe Subscribe Subscribe

yukicoder No.89 どんどんドーナツどーんといこう!

Problem

No.89 どんどんドーナツどーんといこう! - yukicoder

Code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int C = Integer.parseInt(reader.readLine());
        String[] inputs = reader.readLine().split(" ");
        int Rin = Integer.parseInt(inputs[0]);
        int Rout = Integer.parseInt(inputs[1]);
        double r = (Rout - Rin )/2.0;
        double V = ((Rin +Rout) / 2.0) * 2 * Math.PI *  (r * r * Math.PI) * C;
        System.out.println(V);

    }
}