
-Code
import java.util.Scanner;
public class BOJ34922 {
static double pi = 3.141592;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int h = sc.nextInt();
int r = sc.nextInt();
// 왼쪽위 꼭지점이므로 원의 넓이 / 4
double detected = (pi * Math.pow(r, 2)) / 4;
// 반의 총 넓이
double total = w * h;
// 총 넓이에서 감지 넓이 빼주기
double answer = (total - detected);
System.out.println(String.format("%.3f", answer));
}
}'Beakjoon&프로그래머스 > Java' 카테고리의 다른 글
| [백준/Java] 28279번 덱 2 (0) | 2025.12.27 |
|---|---|
| [백준/Java] 12789번 도키도키 간식드리미 (0) | 2025.12.27 |
| [백준/Java] 18258번 큐 2 (0) | 2025.12.26 |
| [백준/Java] 1037번 약수 (0) | 2025.12.26 |
| [백준/Java] 4949번 균형잡힌 세상 (0) | 2025.12.26 |