Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- github
- 편스토랑 우승상품
- hackerrank
- Baekjoon
- 캐치카페
- 캐글
- Real or Not? NLP with Disaster Tweets
- SW Expert Academy
- 데이콘
- Docker
- PYTHON
- 자연어처리
- 백준
- elasticsearch
- AI 경진대회
- 코로나19
- programmers
- 프로그래머스
- dacon
- gs25
- Git
- 더현대서울 맛집
- 편스토랑
- 파이썬
- leetcode
- ubuntu
- Kaggle
- 금융문자분석경진대회
- 맥북
- 우분투
- Today
- 2,043
- Total
- 2,247,729
솜씨좋은장씨
[BaekJoon] 5300번 : Fill the Rowboats! (Python) 본문
728x90
반응형
코딩 1일 1문제! 오늘의 문제는 백준의 Fill the Rowboats! 입니다.
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
👨🏻💻 코드 ( Solution )
def fill_the_rowboats(number):
answer_list = []
number_list = list(range(1, number + 1))
slice_num = len(number_list) // 6 if len(number_list) % 6 == 0 else len(number_list) // 6 + 1
for slice_idx in range(slice_num):
slice_list = list(map(str, number_list[6 * slice_idx: 6 * (slice_idx + 1)]))
slice_list.append("Go!")
answer_list.append(" ".join(slice_list))
return " ".join(answer_list)
if __name__ == "__main__":
number = int(input())
print(fill_the_rowboats(number=number))
GitHub - SOMJANG/CODINGTEST_PRACTICE: 1일 1문제 since 2020.02.07
1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.
github.com
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
[BaekJoon] 4134번 : 다음 소수 (Python) (0) | 2023.01.17 |
---|---|
[BaekJoon] 27110번 : 특식 배부 (Python) (0) | 2023.01.16 |
[BaekJoon] 5618번 : 공약수 (Python) (0) | 2023.01.14 |
[BaekJoon] 23808번 : 골뱅이 찍기 - ㅂ (Python) (0) | 2023.01.13 |
[BaekJoon] 23806번 : 골뱅이 찍기 - ㅁ (Python) (2) | 2023.01.12 |
0 Comments