728x90
6162번: Superlatives
Typically, droughts are classified into “abnormally dry”, “moderate drought”, “severe drought”, “extreme drought”, and “exceptional drought”. The current drought is so “exceptional” in most of California that there have been discuss
www.acmicpc.net
문제 풀이
두 입력값 A, E를 입력 받으면, 조건에 따라 출력해주는 문제이다. E보다 A가 5배 클때마다 "mega"를 더해서 출력해준다. 만약 25배가 클 경우, "mega mega"를 더해 출력해준다.
정답 코드
for i in range(1, int(input()) + 1) :
print(f"Data Set {i}:")
A, E = map(int, input().split())
if E >= A : print("no drought")
else :
mega = A / E
n = 0
while mega > 1 :
mega /= 5
n += 1
print("mega " * (n - 1) + "drought")
print()
728x90
'Algorithm > PS' 카테고리의 다른 글
[BOJ/백준] 6249 - TV Reports [python] (0) | 2023.03.17 |
---|---|
[BOJ/백준] 6190 - Another Cow Number Game [python] (0) | 2023.03.16 |
[BOJ/백준] 6131 - 완전 제곱수 [python] (0) | 2023.03.16 |
[BOJ/백준] 6030 - Scavenger Hunt [python] (0) | 2023.03.16 |
[BOJ/백준] 5949 - Adding Commas [python] (0) | 2023.03.16 |