[백준/파이썬] 13297번 풀이
업데이트:
문제 정보
- 문제 출처: 백준 온라인 저지
- 문제 링크: 13297번 문제
- 문제풀이 코드 GitHub 링크
- 제출 언어: Python 3
풀이
문제
Let’s face it… you are not that handy. When you need to make a major home repair, you often need to hire someone to help. When they come for the first visit, they make an estimate of the cost. Here they must be careful: if they overestimate the cost, it might scare you off, but if they underestimate, the work might not be worth their time.
Because the worker is so careful, it can take a long time for them to produce the estimate. But that’s frustrating — when you ask for an estimate, you really are asking for the magnitude of the cost. …
입력 요약
Input begins with a line containing an integer N (1 ≤ N ≤ 100). The next N lines each contain one estimated cost, which is an integer between 0 and 10100. (Some of the workmen overcharge quite a bit.)
출력 요약
For each estimated cost, output the number of digits required to represent it.
코드
exec('print(len(input()));'*int(input()))
설명
핵심은 구현 관점에서 Let’s face it… you are not that handy. When you need to make a major home repair, you often need to hire someone to help. …를 만족하도록 로직을 구성하는 것입니다.
코드는 입력을 파싱한 뒤 조건 분기와 계산을 순서대로 수행하고, 문제에서 요구한 형식으로 결과를 출력합니다.
경계값과 예외 케이스도 함께 고려해 오답이 나기 쉬운 상황을 방지합니다.
댓글남기기