[백준/파이썬] 15610번 풀이

업데이트:



문제 정보


풀이

문제

Bath’s annual Christmas market runs from the 23rd of November 2017 until the 10th of December 2017. During this time, the market will occupy the entire square courtyard of Bath Abbey.

To brighten things up at night, a single long strand of cheerful festive lights will be run along all four equally long edges of the courtyard.

You will be in charge of buying the electrical wiring to which the lights will be affixed. How much will you need to use to outline the whole Christmas market with festive lights?

입력 요약
The input consists of:

  • One line with an integer a (1 ≤ a ≤ 1018), the area in square metres of the yard.

출력 요약
Output the total length of electrical wiring needed for the market, in metres. The length should be accurate to an absolute or relative error of at most 10−6.

코드

print(int(input())**.5*4)

설명

핵심은 구현 관점에서 Bath’s annual Christmas market runs from the 23rd of November 2017 until the 10th of December 2017. …를 만족하도록 로직을 구성하는 것입니다.

코드는 입력을 파싱한 뒤 조건 분기와 계산을 순서대로 수행하고, 문제에서 요구한 형식으로 결과를 출력합니다.

경계값과 예외 케이스도 함께 고려해 오답이 나기 쉬운 상황을 방지합니다.



다음 읽을거리

관련 허브 페이지에서 같은 주제의 글을 이어서 확인할 수 있습니다.

댓글남기기