結果

問題 No.89 どんどんドーナツどーんといこう!
コンテスト
ユーザー jimano
提出日時 2018-02-10 15:22:06
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 838 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,363 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 44,016 KB
最終ジャッジ日時 2026-04-21 07:56:03
合計ジャッジ時間 6,650 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

package me.yukicoder.lv1_5;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.RoundingMode;

public class No0089 {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int cal = Integer.parseInt(br.readLine());
		String[] r = br.readLine().split(" ");
		int[] round = {Integer.parseInt(r[0]), Integer.parseInt(r[1])};

		double calorie = calcVolume(round[0], round[1]) * cal;
		System.out.println(new BigDecimal(calorie).setScale(5, RoundingMode.HALF_EVEN));

	}

	static double calcVolume(int roundIn, int roundOut) {
		double rad = (roundOut - roundIn) / 2.0;
		double Rad = roundOut - rad;
		return 2 * Math.pow(Math.PI, 2.0) * Math.pow(rad, 2.0) * Rad;
	}
}
0