본문 바로가기

알고리즘/백준코딩

[백준]14761번 파이썬(pypy3) FizzBuzz

반응형
 

14761번: FizzBuzz

Print integers from 1 to N in order, each on its own line, replacing the ones divisible by X with Fizz, the ones divisible by Y with Buzz and ones divisible by both X and Y with FizzBuzz.

www.acmicpc.net

 

 

2020년 10월기준 숏코딩 랭킹 4위

 

 

-

x, y, end = map(int, input().split())

for i in range(1, end+1):

print('Fizz' * (i % x == 0) + 'Buzz' * (i % y == 0) or i)

반응형