본문 바로가기

Algorithm/Math

(C++) - 백준(BOJ) 16600 : Contemporary Art

반응형

https://www.acmicpc.net/problem/16600

 

16600번: Contemporary Art

At the Van Abbemuseum of modern and contemporary art in Eindhoven, we always look to present our muses in the most interesting way possible. Sometimes we have our work cut out for us. Today we are exploring whether we can modify one of our perfectly-square

www.acmicpc.net

간단한 산수문제였습니다.

 

📕 풀이방법

📔 입력 및 초기화

 정사각형의 넓이를 입력할 double형 변수 square를 선언 후 입력합니다.

 

📔 풀이과정

 넓이 = 가로 * 세로이므로 sqrt(square) * 4가 테두리의 길이 입니다.

📔 정답출력

소수점 8번째 자리까지 sqrt(square) * 4를 출력해줍니다.


📕 Code

#include <bits/stdc++.h>
using namespace std;
double square;
int main(){
    cin >> square;
    printf("%.8f", sqrt(square) * 4);
}