본문 바로가기
python-algorithm

백준 5300 Fill the Rowboats!

by 무적김두칠 2022. 12. 22.

https://www.acmicpc.net/problem/5300

 

5300번: Fill the Rowboats!

The output will be the number of each pirate separated by spaces, with the word ”Go!” after every 6th pirate, and after the last pirate.

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
11
def sol(n):
    for i in range(1,n+1):
        print(i,end=' ')
        if i%6==0 or i==n:
            print('Go!',end=' ')
 
 
if __name__ == '__main__':
    n = int(input())
    sol(n)
 
cs
반응형

'python-algorithm' 카테고리의 다른 글

백준 5357 Dedupe  (0) 2022.12.22
백준 26350 Good Coin Denomination  (0) 2022.12.22
백준 25756 방어율 무시 계산하기  (0) 2022.12.22
백준 24072 帰省 (Homecoming)  (0) 2022.12.22
백준 26711 A+B  (0) 2022.12.22

댓글