inblog logo
|
LHS's Study Space
    알고리즘문제풀기랜덤마라톤

    [랜덤 마라톤] 정육각형과 삼각형(14264)

    lhs's avatar
    lhs
    Nov 20, 2024
    [랜덤 마라톤] 정육각형과 삼각형(14264)
    Contents
    1. 문제 풀이 아이디어2. 나의 정답 코드3. 정리
    www.acmicpc.net
    https://www.acmicpc.net/problem/14264
    notion image
    notion image

    1. 문제 풀이 아이디어

    • 삼각형의 넓이를 계산하는 식을 구하면 문제를 해결할 수 있다.

    2. 나의 정답 코드

    public class Main { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(bufferedReader.readLine()); System.out.println(Math.pow(n, 2) / 4 * Math.sqrt(3)); bufferedReader.close(); } }

    3. 정리

    • 삼각형의 넓이는 n²/4*√3으로 계산할 수 있다.
    Share article

    LHS's Study Space

    RSS·Powered by Inblog