반응형
https://www.acmicpc.net/problem/21335
21335번: Another Eruption
A volcano has recently erupted in Geldingadalur, Iceland. Fortunately this eruption is relatively small, and---unlike the infamous Eyjafjallajökull eruption---is not expected to cause delayed international flights or global outrage. There is some concern
www.acmicpc.net
sqrt함수를 사용해보는 간단수학 문제였습니다.
📕 풀이방법
📔 입력 및 초기화
원의 넓이 circularArea, 반지름 radius를 선언하고 원의 넓이를 입력받습니다.
📔 풀이과정
원의 넓이 : (radius ^ 2) \pi $$ 입니다
반지름은 따라서 : sqrt(pi)가 됩니다. 이 값을 radius에 저장합니다.
원의 둘레 : radius * 2 * pi가 됩니다.
📔 정답출력
원의 둘레값을 소수점 10번째 자리에서 반올림하여 출력합니다.
📕 Code
#include <bits/stdc++.h>
#define pi 3.14159265359
using namespace std;
double circularArea, radius;
int main(){
cin >> circularArea;
radius = sqrt(circularArea / pi);
printf("%.9f",2 * radius * pi);
}
'Algorithm > Math' 카테고리의 다른 글
(C++) - 백준(BOJ) 1975: Number Game (0) | 2021.11.22 |
---|---|
(C++) - 백준(BOJ) 1703 : 생장점 (0) | 2021.11.19 |
(C++) - 백준(BOJ) 21185 : Some Sum (0) | 2021.11.11 |
(C++) - 백준(BOJ) 18330 : Petrol (0) | 2021.11.01 |
(C++) - 백준(BOJ) 18005 : Even or Odd? (0) | 2021.10.31 |