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 |
Tags
- 백준
- AI 경진대회
- SW Expert Academy
- gs25
- 파이썬
- Baekjoon
- Docker
- Real or Not? NLP with Disaster Tweets
- 데이콘
- 편스토랑 우승상품
- PYTHON
- 편스토랑
- 금융문자분석경진대회
- ubuntu
- 프로그래머스
- 우분투
- 더현대서울 맛집
- dacon
- ChatGPT
- Git
- 맥북
- programmers
- 자연어처리
- Kaggle
- github
- 프로그래머스 파이썬
- 캐치카페
- 코로나19
- leetcode
- hackerrank
Archives
- Today
- Total
솜씨좋은장씨
[BaekJoon] 5341번 : Pyramids (Python) 본문
728x90
반응형
코딩 1일 1문제! 오늘의 문제는 백준의 Pyramids 입니다.
5341번: Pyramids
The input will be a sequence of integers, one per line. The end of input will be signaled by the integer 0, and does not represent the base of a pyramid. All integers, other than the last (zero), are positive.
www.acmicpc.net
👨🏻💻 문제 풀이
1 부터 n 까지의 합은 n x (n+1) / 2 의 값과 같다 는 공식을 활용하였습니다.
👨🏻💻 코드 ( Solution )
def Pyramids(number):
return number * (number + 1) // 2
if __name__ == "__main__":
while True:
number = int(input())
if number == 0:
break
print(Pyramids(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] 1247번 : 부호 (Python) (0) | 2023.03.16 |
---|---|
[BaekJoon] 4388번 : 받아올림 (Python) (0) | 2023.03.15 |
[Programmers] 배열의 유사도 (Python) (0) | 2023.03.13 |
[BaekJoon] 5347번 : LCM (Python) (0) | 2023.03.12 |
[Programmers] 이진수 더하기 (Python) (0) | 2023.03.11 |
Comments