Skip to content

Commit cb44434

Browse files
committed
[BOJ] #28702. FizzBuzz / 브론즈1 / 20분 / 성공
1 parent 0b43921 commit cb44434

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import sys
2+
from math import ceil
3+
input = sys.stdin.readline
4+
5+
# FizzBuzz 문자열 배열
6+
fizzbuzz = [0] * 3
7+
for i in range(3):
8+
fizzbuzz[i] = input().strip()
9+
10+
for s in fizzbuzz:
11+
if s.isdigit(): # 문자열이 숫자로 이루어져있다면,
12+
idx = fizzbuzz.index(s) # 해당 문자열의 위치를 저장하여
13+
answer = int(fizzbuzz[idx]) + (3 - idx) # 정답 값을 구하기
14+
15+
# FizzBuzz 규칙에 따라 정답 출력
16+
if answer % 3 == 0 and answer % 5 == 0:
17+
print("FizzBuzz")
18+
elif answer % 3 == 0:
19+
print("Fizz")
20+
elif answer % 5 == 0:
21+
print("Buzz")
22+
else:
23+
print(answer)
24+
25+

0 commit comments

Comments
 (0)